forked from heejongahn/dramatic-note
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
41 lines (38 loc) · 1.16 KB
/
webpack.config.js
File metadata and controls
41 lines (38 loc) · 1.16 KB
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
const webpack = require('webpack');
const autoprefixer = require('autoprefixer');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
// Always enabled plugins
const plugs = [
new ExtractTextPlugin('_bundle.css')
];
// Production only plugins
const prod = [
new webpack.DefinePlugin({ 'process.env': { NODE_ENV: JSON.stringify('production') } })
];
module.exports = {
context: `${__dirname}/app/src`,
entry: './main.js',
output: {
path: `${__dirname}/app/static`,
publicPath: '/static/',
filename: '_bundle.js'
},
devServer: {
historyApiFallback: true
},
plugins: process.env.NODE_ENV !== 'production' ? plugs : plugs.concat(prod),
module: {
loaders: [
{ test: /\.png$/, loader: 'file?name=static/[hash].[ext]' },
{ test: /\.(woff(2)?|ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'file?name=fonts/[hash].[ext]' },
{ test: /\.css$/, loader: 'style!css!postcss' },
{ test: /\.scss$/, loader: 'style!css!postcss!sass' },
{
test: /\.jsx?$/,
loader: 'babel',
query: { presets: ['es2015', 'react'] }
}
]
},
postcss: ()/*: Array<Object>*/ => [autoprefixer]
};