-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.base.babel.js
56 lines (45 loc) · 1.4 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
import 'dotenv/config';
import cssnext from 'postcss-cssnext';
import cssimport from 'postcss-import';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import webpack from 'webpack'
export default {
module: {
loaders: [
{
test: /\.css$/,
loader: ExtractTextPlugin.extract(
"style-loader",
process.env.NODE_ENV==="production"
? "css-loader?minimize&modules&importLoaders=1&localIdentName=[local]-[hash:base64:5]!postcss-loader"
: "css-loader?modules&importLoaders=1&localIdentName=[local]-[hash:base64:5]!postcss-loader"
)
},
{
test : /\.js$/,
loader : 'babel-loader'
},
{
test : /\.json$/,
loader : 'json-loader'
},
{
test: /\.(png|jpe?g|gif|svg|mp3|mpe?g)$/,
loader: "file-loader?name=static/assets/[name]-[hash:2].[ext]"
}
]
},
plugins: [
new ExtractTextPlugin("app.css"),
new webpack.DefinePlugin({
'process.env.NODE_ENV': `"${process.env.NODE_ENV||"production"}"`
})
],
cssLoader: {
modules: true
},
postcss : [
cssimport({ path: `${__dirname}/src/app` }),
cssnext()
]
};