-
Notifications
You must be signed in to change notification settings - Fork 373
Expand file tree
/
Copy pathclientWebpackConfig.js
More file actions
29 lines (22 loc) · 973 Bytes
/
clientWebpackConfig.js
File metadata and controls
29 lines (22 loc) · 973 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
// The source code including full typescript support is available at:
// https://github.com/shakacode/react_on_rails_tutorial_with_ssr_and_hmr_fast_refresh/blob/master/config/webpack/clientWebpackConfig.js
const commonWebpackConfig = require('./commonWebpackConfig');
const { getBundler } = require('./bundlerUtils');
const configureClient = () => {
const bundler = getBundler();
const clientConfig = commonWebpackConfig();
clientConfig.plugins.push(
new bundler.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
ActionCable: '@rails/actioncable',
}),
);
// server-bundle is special and should ONLY be built by the serverConfig
// In case this entry is not deleted, a very strange "window" not found
// error shows referring to window["webpackJsonp"]. That is because the
// client config is going to try to load chunks.
delete clientConfig.entry['server-bundle'];
return clientConfig;
};
module.exports = configureClient;