I created a JS lib with some dynamic import init, so I placed /*webpackIgnore:true*/ inside the import command as described by Webpack not to resolve the path variable passed into import function.
Now is my app, it uses the lib said above.
When bundling the app, the comment webpackIgnore is no longer inside the lib bundle, and thus Webpack shows warning:
WARNING in ./src/libs/my-lib/dist/lib.bundle.js 1:173737-173746
Critical dependency: the request of a dependency is an expression
In the lib bundle those dynamic imports are still import(..., but in the app bundle when Webpack minifies again, those dynamic imports are x(... where x is some minified letter.
I'm guessing of some solutions but don't know how to make it
- Tell webpack to keep the webpackIgnore comment in the lib bundle
- Tell webpack not to show warning when bundling the app (this is dangerous, because possibly webpack is resolving the variable passed to
import(...)as null? but practically checked that Webpack leaves those dynamic imports as-is)