Issue:
Following the update of AJV.js to Version 6.4, my vendor bundle now includes the "uri-js" ESNEXT version instead of the ES5 version, causing compatibility issues with IE11.
Analysis:
Upon investigation, I discovered that AJV references uri-js using a require('uri-js')
call and that uri-js comes in two variants:
/node_modules/uri-js/dist/:
- es5
- esnext
Webpack (Version 4.8) bundles the 'esnext' variant of uri-js into the vendor-bundle rather than the 'es5' variant for unknown reasons. I was unable to locate where or how I can specify my preferred build target.
This is my webpack.config.js file:
(contents of webpack.config.js)
package.json:
(contents of package.json)
While I comprehend that my own code gets transpiled to ES5 using the TypeScript (Version 2.8) compiler, the handling of node_modules, specifically those already containing an ES5 version within their dist folder, remains unclear.
In case it influences the situation, here is my tsconfig.json file:
(contents of tsconfig.json)
I also considered implementing Babel to downgrade all node_modules to ES5, but this approach seems excessive given that the modules already include ES5 versions.
Inquiries:
Is there a way to specify that I prefer the ES5 version of the
dist
folder for mynode_modules
? Perhaps in my webpack.config or inpackage.json
?How does the selection process for the appropriate
node_modules/.../dist/
folders work?