2018-10-09 11:32:27 +02:00
|
|
|
const path = require('path');
|
2018-09-12 10:40:12 +02:00
|
|
|
const { environment } = require('@rails/webpacker');
|
2018-07-12 11:50:47 +02:00
|
|
|
|
2018-10-09 11:32:27 +02:00
|
|
|
const resolve = {
|
|
|
|
alias: {
|
|
|
|
'@utils': path.resolve(__dirname, '..', '..', 'app/javascript/shared/utils')
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-04-25 16:30:51 +02:00
|
|
|
environment.splitChunks();
|
2018-10-09 11:32:27 +02:00
|
|
|
environment.config.merge({ resolve });
|
2020-04-07 18:20:53 +02:00
|
|
|
|
|
|
|
// 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];
|
|
|
|
}
|
2021-03-09 11:02:22 +01:00
|
|
|
nodeModulesLoader.exclude.push(
|
2022-02-08 12:49:51 +01:00
|
|
|
path.resolve(__dirname, '..', '..', 'node_modules/maplibre-gl')
|
2021-03-09 11:02:22 +01:00
|
|
|
);
|
2020-01-30 11:26:50 +01:00
|
|
|
|
|
|
|
// Uncoment next lines to run webpack-bundle-analyzer
|
|
|
|
// const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
|
|
|
// environment.plugins.append('BundleAnalyzer', new BundleAnalyzerPlugin());
|
|
|
|
|
2018-09-12 10:40:12 +02:00
|
|
|
module.exports = environment;
|