forked from cerebroapp/cerebro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.base.js
52 lines (50 loc) · 1.36 KB
/
webpack.config.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
49
50
51
52
const webpack = require('webpack');
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const LodashModuleReplacementPlugin = require('lodash-webpack-plugin');
// all dependecies from app/package.json will be included in build/node_modules
const externals = Object.assign(
require('./app/package.json').dependencies,
require('./app/package.json').optionalDependencies
);
module.exports = {
module: {
loaders: [{
test: /\.jsx?$/,
loaders: ['babel-loader'],
exclude: /node_modules/
}, {
test: /\.json$/,
loader: 'json-loader'
}, {
test: /\.jpe?g$|\.gif$|\.png$|\.svg$|\.woff$|\.ttf$|\.wav$|\.mp3$/,
loader: 'url-loader'
}]
},
output: {
path: path.join(__dirname, 'app'),
filename: '[name].bundle.js',
libraryTarget: 'commonjs2'
},
resolve: {
extensions: ['', '.js', '.jsx'],
root: [
path.resolve('./app'),
path.resolve('./node_modules'),
]
},
postcss: () => [
require('autoprefixer'),
require('postcss-nested'),
],
plugins: [
new LodashModuleReplacementPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
}),
new CopyWebpackPlugin([
{ from: 'app/main/css/themes/*', to: './main/css/themes/[name].[ext]' }
])
],
externals: Object.keys(externals || {})
};