-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.base.babel.js
56 lines (53 loc) · 1.43 KB
/
webpack.base.babel.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
50
51
52
53
54
55
56
const webpack = require('webpack');
const path = require('path');
const paths = require('../paths');
const config = require('../config');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const preLoaders = config.eslint ? [
// linting with eslint
{
test: /\.jsx?$/, // test for both js and jsx
loader: 'eslint',
include: paths.SRC,
exclude: paths.ASSETS
}
] : [];
module.exports = {
resolve: {
root: [paths.NODE_MODULES, paths.SRC, paths.COMPONENTS, paths.ROUTES]
},
stats: {
children: false
},
plugins: [
// Define free variables. Useful for having development builds with debug logging or adding global constants.
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new HtmlWebpackPlugin({
filename: 'popup/index.html',
template: path.resolve(__dirname, '../templates/popup/index.html'),
inject: 'body',
chunks: ['popup']
})
],
externals: { window: 'window' },
module: {
preLoaders,
loaders: [
{
test: /\.jsx?$/, // test for both js and jsx
loader: 'babel',
exclude: [paths.ASSETS],
include: [paths.SRC, paths.TEST, /buildo-react-components/]
},
// copy required static files
{
test: /\.(jpg|png|json)$/,
loader: `file-loader?name=[path][name].[ext]&context=${paths.SRC}`
},
{
test: paths.THEME_VARIABLES,
loader: 'sass-variables'
}
]
}
};