-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.base.js
68 lines (65 loc) · 1.85 KB
/
webpack.config.base.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
'use strict'
var webpack = require('webpack')
var path = require('path')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
var CopyFilesPlugin = require('copy-webpack-plugin')
var ManifestPlugin = require('webpack-manifest-plugin')
var dependencies = require('./package.json').dependencies
module.exports = {
entry: {
app: [path.join(__dirname, 'src', 'client.js')],
vendor: Object.keys(dependencies)
},
output: {
path: path.join(__dirname, 'dist'),
publicPath: '/dist'
},
module: {
noParse: /\.min\.js/,
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: []
}
}
},
{ test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, use: 'url?limit=10000&mimetype=application/font-woff' },
{ test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, use: 'url?limit=10000&mimetype=application/font-woff' },
{ test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, use: 'url?limit=10000&mimetype=image/svg+xml' },
{ test: /\.jpg$/, use: 'url-loader?limit=100000' },
{ test: /\.png$/, use: 'url-loader?limit=100000' },
{ test: /\.gif$/, use: 'url-loader?limit=100000' },
{ test: /\.jpg$/, use: 'file-loader' },
{
test: /\.css$/, use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: 'css-loader'
})}
]
},
plugins: [
new CopyFilesPlugin([{
from: './src/images',
to: './images'
}, {
from: './src/fonts',
to: './fonts'
}]),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.SourceMapDevToolPlugin({
filename: '[name].js.map'
}),
new ManifestPlugin({
fileName: 'stats.json',
// Exclude sourcemaps
filter: ({name}) => {
if (name.endsWith('map')) return false
return true
}
})
]
}