-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.base.js
54 lines (53 loc) · 1.67 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
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const autoprefixer = require('autoprefixer');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const books = require('./config/books.json');
module.exports = {
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV),
BOOKS: JSON.stringify(books)
}
}),
new HtmlWebpackPlugin({
template: './src/html/index.html',
inject: false
}),
new CopyWebpackPlugin([
{ from: './static/images', to: './images' }
])
],
module: {
loaders: [
{
test: /\.js$/,
loaders: ['babel'],
include: /src/
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract('style',
'css?modules&importLoaders=1&localIdentName=[folder]__[local]-[hash:base64:5]!postcss'),
include: /src/
},
{
test: /\.(png|jpg|jpeg|gif|svg|ico|woff|woff2|eot)$/,
loader: 'url?name=[name].[ext]&limit=8192',
include: /src/
},
{
test: /\.(png|jpg|jpeg|gif|svg|ico|woff|woff2|eot)$/,
loader: 'file?name=[name].[ext]&limit=8192',
include: /static\/images/
}
]
},
postcss() {
return [
autoprefixer({ browsers: ['last 2 versions'] })
];
}
};