ngx-awesome-popup icon indicating copy to clipboard operation
ngx-awesome-popup copied to clipboard

Can't import the named export 'XXX from non EcmaScript module (only default export is available)

Open mrjaros opened this issue 2 years ago • 3 comments

I can't build an application with this module. My environment is as follows: `Angular CLI: 11.2.18 Node: 10.19.0 OS: linux x64

Angular: 11.2.14 ... animations, common, compiler, compiler-cli, core, forms ... language-service, platform-browser, platform-browser-dynamic ... router Ivy Workspace: Yes

Package Version

@angular-devkit/architect 0.1102.18 @angular-devkit/build-angular 0.1102.18 @angular-devkit/core 11.2.18 @angular-devkit/schematics 11.2.18 @angular/cdk 11.2.13 @angular/cli 11.2.18 @angular/material 11.2.13 @schematics/angular 11.2.18 @schematics/update 0.1102.18 rxjs 6.6.7 typescript 4.1.5 `

I build an application with: ng build --prod --aot --vendor-chunk --common-chunk --delete-output-path --build-optimizer

Before importing ngx-awesome-popup I was able to build and run this application. After setting things like in demo page, I got bunch of similar errors in build stage (output shortened: `> @0.0.0 prebuild /...

ts-node -O '{"module": "commonjs"}' git.version.ts version: '0.0.0', revision: '...', branch: '...' @0.0.0 build /... ng build --prod --aot --vendor-chunk --common-chunk --delete-output-path --build-optimizer Generating browser application bundles... ✔ Browser application bundle generation complete. Warning: /.../src/app/app.module.ts depends on 'hammerjs'. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies Error: ./node_modules/@costlydeveloper/ngx-awesome-popup/fesm2015/costlydeveloper-ngx-awesome-popup.mjs 3238:12-29 Can't import the named export 'ApplicationRef' from non EcmaScript module (only default export is available) at HarmonyImportSpecifierDependency._getErrors (/.../node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:88:6) at HarmonyImportSpecifierDependency.getErrors (/.../node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:68:16) at Compilation.reportDependencyErrorsAndWarnings (/.../node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/Compilation.js:1463:22) at hooks.finishModules.callAsync.err (/.../node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/Compilation.js:1258:10) at _next0 (eval at create (/.../node_modules/tapable/lib/HookCodeFactory.js:33:10), :43:1) at _promise0.then._result0 (eval at create (/.../node_modules/tapable/lib/HookCodeFactory.js:33:10), :57:1) at process._tickCallback (internal/process/next_tick.js:68:7) @ ./src/app/app.module.ts @ ./src/main.ts @ multi ./src/main.ts ... Error: ./node_modules/@costlydeveloper/ngx-awesome-popup/fesm2015/costlydeveloper-ngx-awesome-popup.mjs 3630:31-46 Can't import the named export 'BehaviorSubject' from non EcmaScript module (only default export is available) at HarmonyImportSpecifierDependency._getErrors (/.../node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:88:6) at HarmonyImportSpecifierDependency.getErrors (/.../node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:68:16) at Compilation.reportDependencyErrorsAndWarnings (/.../node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/Compilation.js:1463:22) at hooks.finishModules.callAsync.err (/.../node_modules/@angular-devkit/build-angular/node_modules/webpack/lib/Compilation.js:1258:10) at _next0 (eval at create (/.../node_modules/tapable/lib/HookCodeFactory.js:33:10), :43:1) at _promise0.then._result0 (eval at create (/.../node_modules/tapable/lib/HookCodeFactory.js:33:10), :57:1) at process._tickCallback (internal/process/next_tick.js:68:7) @ ./src/app/app.module.ts @ ./src/main.ts @ multi ./src/main.ts`

Looks like the core issue here is Can't import the named export 'XXX' from non EcmaScript module (only default export is available)

mrjaros avatar Jan 28 '22 10:01 mrjaros

I can provide full output if needed, but it is basically what I pasted above, only export names (ApplicationRef, BehaviorSubject) changes. So I believe we should have the issue fixed when first problem will be resolved. Full outputs takes 13k lines of text.

mrjaros avatar Jan 28 '22 11:01 mrjaros

Same issue.

Nuajan avatar Feb 18 '22 10:02 Nuajan

I am sorry for a long time without an answer, I am not sure why does this happen, I was not able to reproduce the issue. The only thing I see that could fix that is to upgrade node version, ver. 10 is a little old.

boris-jenicek avatar Mar 13 '22 18:03 boris-jenicek