angular-ab-tests icon indicating copy to clipboard operation
angular-ab-tests copied to clipboard

Compile fails on Angular 8 with enableIvy:true

Open abbas999 opened this issue 5 years ago • 5 comments

Build a project that uses angular-ab-tests on Angular 8 after adding

"angularCompilerOptions": {
  "enableIvy": true
}

to tsconfig.app.json. Compile fails with the following error:

ERROR in ENOENT: no such file or directory, open '/my_angular_project/node_modules/angular-ab-tests/angular-ab-tests.js'

This is because package.json mentions

"module": "angular-ab-tests.js"

while no such file exists. If I manually change angular-ab-tests.js to index.js, all works fine.

abbas999 avatar Jun 05 '19 07:06 abbas999

Hi @abbas999, thank you for pointing this out, I'll fix it ASAP

adrdilauro avatar Jun 05 '19 07:06 adrdilauro

Hey there,

I just created an empty Angular8 project, installed angular-ab-tests, and enabled Ivy compiler.

I don't get the error you mention, but I get instead an error related to @ngx-utils/cookies

ERROR in ./node_modules/angular-ab-tests/__ivy_ngcc__/fesm5/angular-ab-tests.js 749:16-30
"export 'CookiesService' was not found in '@ngx-utils/cookies'
ERROR in ./node_modules/angular-ab-tests/__ivy_ngcc__/fesm5/angular-ab-tests.js 752:227-241
"export 'CookiesService' was not found in '@ngx-utils/cookies'
ERROR in ./node_modules/angular-ab-tests/__ivy_ngcc__/fesm5/angular-ab-tests.js 758:38-52
"export 'CookiesService' was not found in '@ngx-utils/cookies'
ERROR in ./node_modules/@ngx-utils/cookies/__ivy_ngcc__/index.js
Module not found: Error: Can't resolve './src/cookies-options.service' in '/Users/adriano/Documents/Boat International/Progetti/beppe/node_modules/@ngx-utils/cookies/__ivy_ngcc__'
ERROR in ./node_modules/@ngx-utils/cookies/__ivy_ngcc__/index.js
Module not found: Error: Can't resolve './src/cookies.service' in '/Users/adriano/Documents/Boat International/Progetti/beppe/node_modules/@ngx-utils/cookies/__ivy_ngcc__'

The module @ng-utils/cookies was introduced as a dependency to make Angular Universal work. I installed the previous version of angular-ab-tests by running

npm install angular-ab-tests@"<1.3.0"

and the compilation worked fine.

Now, I have got two problems:

  • First, how to reproduce the error you experienced, since I couldn't see it
  • Second, why you didn't see the problem with ng-cookies? Maybe that would have occurred if your Ivy compiler had succeeded finding angular-ab-tests?

adrdilauro avatar Jun 05 '19 21:06 adrdilauro

I'm seeing the issue you pointed out now too. I've been following discussions on angular bugs and it seems like a lot of these issues can be resolved by using ng-packagr (https://github.com/ng-packagr/ng-packagr) to push to npm. Do you use ng-packagr?

abbas999 avatar Jun 12 '19 08:06 abbas999

I am already using ng-packagr. It's possible though that the latest version of ng-packagr tackles different issues that are relative specifically to the Ivy compiler, this evening I'll try to download the latest version of ng-packagr and pack the module again, I'll keep you updated.

How did you resolve the first problem you had experienced? The missing index.ts file?

adrdilauro avatar Jun 12 '19 09:06 adrdilauro

There is a problem with @ngx-utils/cookies, I opened this issue in their repo and asked them for clarifications. You can look at the issue and if you have any ideas please let me know.

adrdilauro avatar Jun 12 '19 22:06 adrdilauro