-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.common.js
66 lines (64 loc) · 1.75 KB
/
webpack.common.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
//run webpack-dev-server --content-base dist
//https://webpack.github.io/docs/configuration.html
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
plugins:[
new ExtractTextPlugin({
filename: 'style.css',
disable: false,
allChunks: true
})
],
entry:[
'./src/index.js',
'./src/index.html'
],
output:{
path: path.resolve(__dirname,'dist'),
filename:'bundle.js'
},
module:{
rules:[
{
test: /\.jsx?$/,
include: path.resolve(__dirname,'src'),
use:{
loader:'babel-loader',
options:{
presets:['es2015','react','stage-2']
}
}
},
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{
loader: 'css-loader',
options: {
sourceMap: true
}
},
{
loader: 'sass-loader',
options: {
sourceMap: true
}
}
]
})
},
{ test: /\.woff(\d+)?$/, loader: 'url-loader?prefix=font/&limit=5000&mimetype=application/font-woff' },
{ test: /\.ttf$/, loader: 'file-loader?prefix=font/' },
{ test: /\.eot$/, loader: 'file-loader?prefix=font/' },
{ test: /\.svg$/, loader: 'file-loader?prefix=font/' },
{ test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "url-loader?limit=10000&minetype=application/font-woff"},
{ test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "file-loader" },
{ test: /\.(png|svg|jpg|gif)$/, loader:"file-loader"},
{ test: /\.html$/, loader: 'file-loader?name=[name].[ext]'}
]
}
}