-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathwebpack.local.config.js
49 lines (42 loc) · 1.43 KB
/
webpack.local.config.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
49
const webpack = require('webpack');
const baseConfig = require('./webpack.base.config');
const BundleTracker = require('webpack-bundle-tracker');
const path = require('path');
const nodeModulesDir = path.resolve(__dirname, 'node_modules');
const yaml = require('yamljs');
const settings = yaml.load('settings/settings.yaml');
const port = settings.environment_variables.WEBPACK_SERVER_PORT;
// baseConfig[1].devtool = '#source-map';
baseConfig[1].entry = [
'webpack-dev-server/client?http://localhost:' + port,
'webpack/hot/only-dev-server',
'bootstrap-loader',
'./assets/js/index',
];
baseConfig[0].output['publicPath'] = 'http://localhost:' + port + '/assets/bundles/';
baseConfig[0].port = port;
baseConfig[1].output = {
path: path.resolve('./assets/bundles/'),
publicPath: 'http://localhost:' + port + '/assets/bundles/',
filename: '[name].js',
};
baseConfig[1].module.loaders.push({
test: /\.jsx?$/,
exclude: [nodeModulesDir],
loaders: ['babel?presets[]=react,presets[]=es2015']
});
baseConfig[1].plugins = [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(), // don't reload if there is an error
new BundleTracker({
filename: './webpack-stats.json'
}),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery",
"window.Tether": 'tether',
"Tether": 'tether',
})
];
module.exports = baseConfig;