Improve the mapbox-gl support detection for older browsers
This commit is contained in:
parent
56e9834389
commit
d18bc1c421
4 changed files with 93 additions and 191 deletions
|
@ -9,9 +9,21 @@ const resolve = {
|
|||
|
||||
environment.splitChunks();
|
||||
environment.config.merge({ resolve });
|
||||
environment.loaders.get(
|
||||
'nodeModules'
|
||||
).exclude = /(?:@?babel(?:\/|\\{1,2}|-).+)|regenerator-runtime|core-js|^webpack$|^webpack-assets-manifest$|^webpack-cli$|^webpack-sources$|^@rails\/webpacker$|^mapbox-gl$|/;
|
||||
|
||||
// Excluding node_modules From Being Transpiled By Babel-Loader
|
||||
// One change to take into consideration,
|
||||
// is that Webpacker 4 transpiles the node_modules folder with the babel-loader.
|
||||
// This folder used to be ignored by Webpacker 3.
|
||||
// The new behavior helps in case some library contains ES6 code, but in some cases it can lead to issues.
|
||||
// To avoid running babel-loader in the node_modules folder, replicating the same behavior as Webpacker 3,
|
||||
// we added the following code:
|
||||
|
||||
const nodeModulesLoader = environment.loaders.get('nodeModules');
|
||||
if (!Array.isArray(nodeModulesLoader.exclude)) {
|
||||
nodeModulesLoader.exclude =
|
||||
nodeModulesLoader.exclude == null ? [] : [nodeModulesLoader.exclude];
|
||||
}
|
||||
nodeModulesLoader.exclude.push(/mapbox-gl/);
|
||||
|
||||
// Uncoment next lines to run webpack-bundle-analyzer
|
||||
// const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue