-
Notifications
You must be signed in to change notification settings - Fork 373
Expand file tree
/
Copy pathclient.js
More file actions
31 lines (26 loc) · 972 Bytes
/
client.js
File metadata and controls
31 lines (26 loc) · 972 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const devBuild = process.env.NODE_ENV === 'development';
const isHMR = process.env.WEBPACK_DEV_SERVER === 'TRUE';
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
const { config } = require('shakapacker');
const environment = require('./environment');
// Auto-detect bundler from shakapacker config and load the appropriate library
const bundler = config.assets_bundler === 'rspack'
? require('@rspack/core')
: require('webpack');
if (devBuild && !isHMR) {
environment.loaders.get('sass').use.find((item) => item.loader === 'sass-loader').options.sourceMap = false;
}
environment.plugins.append(
'Provide',
new bundler.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
jquery: 'jquery',
'window.jQuery': 'jquery',
Popper: ['popper.js', 'default'],
}),
);
if (devBuild && isHMR) {
environment.plugins.insert('ReactRefreshWebpackPlugin', new ReactRefreshWebpackPlugin());
}
module.exports = environment;