Migrating typings - rollup problem?

I had typings definition for faker, so I followed this instructions to use types.

I have faker installed (npm install faker) and types@faker, also deleted typings.json and typings directory.

It’s seem that is everything ok, but when I try to access a property or method of faker object lead to error.
This same code works with ionic beta + typings.

ionic serve output

[18:59:21]  rollup: Export 'image' is not defined by '/Projects/src/pages/page/page.ts'

[18:59:21]  rollup: Export 'helpers' is not defined by '/Projects/src/pages/page.ts'

[18:59:21]  rollup: Export 'lorem' is not defined by '/Projects/src/pages/page.ts'

JS changed:   www/build/main.js
[18:59:31]  bundle dev update finished in 14.94 s
[18:59:31]  sass started ...
[18:59:31]  sass finished in 39 ms

code

import  * as faker from "faker";

export class HomePage {
	ngAfterViewInit() {
		console.log(faker); // ok
		console.log(faker.image.avatar); //error
	}
}

console.log(faker)

Object {default: Faker, moduleExports: Faker}
moduleExports: Faker
address: Address

commerce: Commerce

company: Company

date: Datedefinitions: Object
fake: fake(str)_
finance: Finance_
hacker: Hacker_
helpers: Helpers_
image: Image_
internet: Internet_

console.log(faker.image.avatar)

error_handler.js:47 EXCEPTION: Error in … caused by: Cannot read property ‘avatar’ of undefined


Did you manage to solve this? I’ve run into a similar problem with three.js.
I did

npm install three --save
npm install @types/three

then in my code if i do

import THREE from 'three';

console.log(THREE) gives undefined

if i do

import * as THREE from 'three';

ionic serve output

[22:06:53]  rollup: Export 'Scene' is not defined by 'C:\Development\workspace\Plack\src\services\render-service.ts'
[22:06:53]  rollup: Export 'PerspectiveCamera' is not defined by 'C:\Development\workspace\Plack\src\services\render-service.ts'
[22:06:53]  rollup: Export 'WebGLRenderer' is not defined by 'C:\Development\workspace\Plack\src\services\render-service.ts'
... etc

These are the functions used in my code.

to test further, i imported a second time as ‘Three’, which is not used anywhere in my code except for this console.log line.

console.log(Three)

Object
__moduleExports
:
Object
AddEquation
:
100
AddOperation
:
2
AdditiveBlending
:
2
AlphaFormat
:

…etc

Looks like the module is inside __moduleExports.
Hope someone can help?

Hello,

I have the same issue with pixijs v4 …
I will becoming crazy.
Ionic Team, have you got a workaround ?
Best regards.

Problem dissapear with @ionic/app-scripts 0.0.37
:slight_smile:

Well good for you!

I just installed 0.0.37 but still no luck…