For your error, it appears you are using webpack, so I’m not sure why it’s unable to trace those dependencies. Are you using TypeScript or JavaScript? Can you try add those lines in your webpack plugins config:
Hi, I had the same issue as @pwelter34, and pinning down webpack with "webpack": "~4.28.0" in my package.json helped. Until the issue is fixed in 4.29.x, this will do. Thanks for the help! BTW, I am using the latest aurelia-dialog 2.0.0-rc.5 (as of this writing)
@StrahilKazlachev may I understand why we are using explicitly esm import() here? Instead of using aurelia-loader loadModule() which normalizes those things?
I think doing that would require configuration, while employing native import API would allow us to cope better with bundlers, which is general direction it has been
aurelia-dialog is in an Aurelia app which has bootstrapped correct loader-default/loader-webpack. I thought there is nothing needed for aurelia-dialog to use loadModule() ?
When using Webpacm, string passed to loadModule will not be naturally understood as a dependency, but import(). Thats why its working atm. For requirejs, it would work as is because of its module preservation nature, so it will be able to figure out what to load from an almost random module loading call like loadModule
@huochunpengaurelia-dialog provides some default resources - heading, body, footer, etc. It also has a config API whether to “include” them or not. For versions 1.x, including beta and rc ones, that just meant not to register those as global resources. When not used, excluding them from bundles was not straightforward IMHO. My intention of using import() was to make them properly optional, without using some custom solutions. Here is the PR and the feedback it got before merging, hence 2.x being rc.
However later my multiple entry points caused runtime error " Uncaught TypeError: Cannot read property ‘call’ of undefined"
To fix this I had to update webpack above 4.30.0 as per discussed in https://github.com/webpack/webpack/issues/8996.
Just updated to the latest bits (“aurelia-dialog”: “^2.0.0-rc.6”,“aurelia-cli”: “^1.0.0”,) and this fix no longer works. Any ideas on how to move past the following error:
ERROR in ./node_modules/aurelia-dialog/dist/native-modules/aurelia-dialog.js 19:29
Module parse failed: Unexpected token (19:29)
You may need an appropriate loader to handle this file type.
|
| var RENDERRERS = {
> ux: function () { return import('./ux-dialog-renderer.js').then(function (m) { return m.DialogRenderer; }); },
| native: function () { return import('./native-dialog-renderer.js').then(function (m) { return m.NativeDialogRenderer; }); }
| };
@ ./src/main.ts
@ ./node_modules/aurelia-webpack-plugin/runtime/empty-entry.js
@ multi aurelia-webpack-plugin/runtime/empty-entry aurelia-webpack-plugin/runtime/pal-loader-entry aurelia-webpack-plugin/runtime/empty-entry aurelia-webpack-plugin/runtime/pal-loader-entry aurelia-bootstrapper