I have an Aurelia app and I'm using the webpack bundler and related webpack.config.json generated upon project initialization (by "au init").
Everything works fine as long as I bundle the app in development mode with:
webpack --watch
But when I switch to bundling it in production mode with:
webpack --env production --watch
I start getting run-time errors upon opening one of the dialogs, like:
Uncaught (in promise) Error: Unable to find module with ID: 41474.html
I know the error above is usually caused by not wrapping modules' references in a "PLATFORM.moduleName()" function call, but I'm pretty sure I wrapped all such references in my code, be it in my main.js file, in routes' definitions, in aurelia.setRoot() calls.
Since I get no such error in development mode, my issue seems to be caused by some setting specific to the production mode, quite likely minification. I tried to play with the minification options of the HtmlWebpackPlugin in webpack.config.js but without success.
I can see references to module 41474 are present in a few of the bundles produced by webpack:
find ./public -type f -exec grep -EHno '41474' {} \;
./public/app-4e1129b6.435747a3fab79a037cba.bundle.js:1:41474
./public/app-4e1129b6.435747a3fab79a037cba.bundle.js:1:41474
./public/app-83a5eedf.74d539a4279fc82b0267.bundle.js:1:41474
./public/app-18b82e98.a3f5631d890b757a9a2d.bundle.js:1:41474
and when I look into those bundles, I see the module is passed to a function whose name has been minified like n(41474). It is hard to debug the minified code any further.
Any idea how can I get rid of this error?
Is there any other module reference I need to wrap in PLATFORM.moduleName calls?