-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
71 lines (69 loc) · 2.16 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
65
66
67
68
69
70
71
var webpack = require('webpack');
var path = require('path');
var OpenBrowserPlugin = require('open-browser-webpack-plugin');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
devServer: {
historyApiFallback: true,
hot: true,
inline: true,
contentBase: './app',
port: 8080
},
entry: path.resolve(__dirname, 'app/app.js')
,
output: {
path: __dirname + '/build',
publicPath: '/',
filename: './bundle.js'
},
module: {
loaders:[
{
test: /\.scss$/,
include: path.resolve(__dirname, 'app'),
exclude: /node_modules/,
loaders: [
'style-loader?sourceMap',
'css-loader?modules&importLoaders=1&localIdentName=[path]___[name]__[local]___[hash:base64:5]',
'resolve-url',
'sass-loader?sourceMap'
]
},
{
test: /\.css$/,
include: path.resolve(__dirname, 'app'),
exclude: /node_modules/,
loader: ExtractTextPlugin.extract({
fallbackLoader: "style-loader?sourceMap",
loader: "css-loader?modules&importLoaders=1&localIdentName=[path]___[name]__[local]___[hash:base64:5]"
})
// 'style-loader?sourceMap',
// 'css-loader?modules&importLoaders=1&localIdentName=[path]___[name]__[local]___[hash:base64:5]'
// ]
},
{
test: /\.(gif|jpe?g|png|ico)$/,
loader: 'url-loader?limit=10000'
},
{
test: /\.(otf|eot|svg|ttf|woff|woff2).*$/,
loader: 'url-loader?limit=10000'
},
{ test: /\.(njk|nunjucks)$/, loader: 'nunjucks-loader' },
{ test: /\.json$/, include: path.resolve(__dirname, 'app'), exclude: /node_modules/, loader: 'json-loader' },
{ test: /\.jsx?$/, include: path.resolve(__dirname, 'app'), exclude: /node_modules/, loader: 'babel-loader' },
]
},
// postcss: function () {
// return [require('autoprefixer'), require('precss')];
// },
resolve: {
extensions: ['.js', '.jsx'],
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new OpenBrowserPlugin({ url: 'http://localhost:8080' }),
new ExtractTextPlugin("styles.css")
]
};