This is an example library built with webpack 5 to demo an issue when consumed in an app that uses webpack 4.
- In module directory is a js module that is bundled with webpack 5.
- In library directory is a js library that is bundled with webpack 5 and re-exports the webpack-5 bundled module, leaving it as external.
- In app directory is a js app that is bundled with webpack 4 that tries to use module through library.
Repro steps:
cd app
;npm ci
;npm start
;- Open
http://localhost:8080/
, see error in console:Uncaught TypeError: i[e] is not a function
Conditions necessary to reproduce the issue:
module
andlibrary
are bundled with webpack@5library
is bundled with TerserPlugin withkeep_fnames: true
library
has a async loaded moduleapp
is bundled with webpack@4