-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
65 lines (54 loc) · 1.38 KB
/
webpack.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
const precss = require('precss');
const autoprefixer = require('autoprefixer');
const postcssImport = require('postcss-import');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const cssLoaderOptions = [
'modules',
'importLoaders=1',
'localIdentName=[local]___[hash:base64:5]',
].join('&');
module.exports = {
devtool: 'cheap-module-eval-source-map',
entry: './web/static/frontend/entry.js',
output: {
path: './priv/static/js',
filename: 'bundle.js',
},
module: {
loaders: [
{
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2015', 'react'],
},
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract('style-loader',
`css-loader?${cssLoaderOptions}!postcss-loader`),
},
],
},
plugins: [
new ExtractTextPlugin('../css/bundle.css', {
allChunks: true,
}),
new CopyWebpackPlugin([
{ from: './web/static/vendor/js/', to: '../js/' },
{ from: './web/static/vendor/css/', to: '../css/' },
{ from: './web/static/assets', to: '..' },
]),
],
postcss(webpack) {
return [
postcssImport({
addDependencyTo: webpack,
}),
precss,
autoprefixer,
];
},
};