-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.base.js
57 lines (55 loc) · 1.81 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
'use strict'
var webpack = require('webpack')
var path = require('path')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
var CopyFilesPlugin = require('copy-webpack-plugin')
var config = require('./package.json')
module.exports = {
entry: {
app: [
path.join(__dirname, 'src', 'client.js'),
],
vendor: Object.keys(config.dependencies)
},
output: {
path: path.join(__dirname, 'docs'),
publicPath: '/docs',
filename: 'bundle.v' + config.version + '.js',
},
module: {
rules: [
{ test: /\.jsx?$/, exclude: /node_modules/, use: 'babel-loader'},
{ 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'
})}
]
},
resolve: {
alias: {
react: 'preact-compat',
'react-dom': 'preact-compat',
// See: https://github.com/developit/preact-compat/issues/47
'create-react-class': 'preact-compat/lib/create-react-class'
}
},
plugins: [
new ExtractTextPlugin('vendor.styles.v' + config.version + '.css'),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
filename: 'vendor.bundle.v' + config.version + '.js'
}),
new CopyFilesPlugin([{
from: './src/images',
to: './images'
}]),
new webpack.NoEmitOnErrorsPlugin()
]
}