forked from edwardfxiao/prerender-loader-test-repo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase.js
executable file
·48 lines (47 loc) · 1.19 KB
/
base.js
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
const webpack = require('webpack');
const path = require('path');
const PATH = require('./build_path');
const WebpackAssetsManifest = require('webpack-assets-manifest');
const ENTRY_LIST_OPTION = ['index', 'show'];
const entry = {};
ENTRY_LIST_OPTION.filter(i => {
entry[i] = `${PATH.ROOT_PATH}/${i}.js`;
});
var config = (module.exports = {
context: PATH.ROOT_PATH,
entry,
module: {
rules: [
{
test: /\.jsx?$/,
include: [PATH.ROOT_PATH],
exclude: [PATH.NODE_MODULES_PATH],
enforce: 'pre',
enforce: 'post',
loader: 'babel-loader',
options: {
presets: ['env', 'react', 'stage-0'],
},
},
],
},
resolve: {
modules: ['node_modules', path.resolve(__dirname, 'app')],
extensions: ['.js', '.json', '.jsx', '.css'],
},
devtool: 'source-map',
devServer: {
contentBase: path.join(__dirname, 'dist'),
compress: true,
disableHostCheck: true,
historyApiFallback: true,
host: '0.0.0.0',
port: 3000,
},
plugins: [
new webpack.ContextReplacementPlugin(/\.\/locale$/, 'empty-module', false, /js$/),
new WebpackAssetsManifest({
output: 'manifest.json',
}),
],
});