-
Notifications
You must be signed in to change notification settings - Fork 408
Expand file tree
/
Copy pathwebpack.dev.config.babel.js
More file actions
57 lines (47 loc) · 1.71 KB
/
Copy pathwebpack.dev.config.babel.js
File metadata and controls
57 lines (47 loc) · 1.71 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* eslint-disable max-len, no-console, import/no-extraneous-dependencies */
import path from 'path';
import config from 'config';
import webpack from 'webpack';
import WebpackIsomorphicToolsPlugin from 'webpack-isomorphic-tools/plugin';
import { getPlugins, getRules } from './webpack-common';
import webpackConfig from './webpack.prod.config.babel';
import webpackIsomorphicToolsConfig from './src/amo/server/webpack-isomorphic-tools-config';
import { WEBPACK_ENTRYPOINT } from './src/amo/constants';
const webpackIsomorphicToolsPlugin = new WebpackIsomorphicToolsPlugin(
webpackIsomorphicToolsConfig,
);
const babelConfig = require('./babel.config');
const babelPlugins = babelConfig.plugins || [];
export const babelOptions = {
...babelConfig,
plugins: babelPlugins,
};
const hmr = `webpack-hot-middleware/client?path=${config.get(
'staticPath',
)}__webpack_hmr`;
const entryPoints = { [WEBPACK_ENTRYPOINT]: [hmr, 'amo/client'] };
// We do not want the production optimization settings in development.
delete webpackConfig.optimization;
export default {
...webpackConfig,
mode: 'development',
devtool: 'cheap-module-source-map',
context: path.resolve(__dirname),
entry: entryPoints,
output: {
...webpackConfig.output,
filename: '[name]-[contenthash].js',
chunkFilename: '[name]-[contenthash].js',
// We need to remove the protocol because of `npm run amo:dev-https`.
publicPath: config.get('staticPath'),
},
module: {
rules: getRules({ babelOptions, bundleStylesWithJs: true }),
},
plugins: [
...getPlugins(),
new webpack.HotModuleReplacementPlugin(),
new webpack.IgnorePlugin({ resourceRegExp: /webpack-stats\.json$/ }),
webpackIsomorphicToolsPlugin.development(),
],
};