-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
60 lines (58 loc) · 1.43 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
const ExtractText = require('extract-text-webpack-plugin');
const path = require('path');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const webpack = require('webpack');
const extractHtml = new ExtractText('index.html');
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'build'),
filename: 'index.js',
},
module: {
rules: [
{
test: /\.ejs$/,
loader: 'ejs-loader',
},
{
test: /\.js$/,
exclude: /node_modules\/(?!(query-string|strict-uri-encode))/,
loader: 'babel-loader',
query: {
presets: ['es2015'],
plugins: ['transform-runtime'],
},
},
{
test: /\.html$/,
loader: extractHtml.extract('html-loader'),
},
{
test: /\.scss$/,
loaders: ['css-loader', 'sass-loader'],
},
{
test: /\.svg$/,
loaders: ['url-loader', `svgo-loader?${JSON.stringify({
plugins: [
// for IE11, otherwise SVG scaling is broken
{ removeViewBox: false },
],
})}`],
},
{
test: /\.(eot|woff|ttf)$/,
loaders: ['url-loader'],
},
],
},
plugins: [
extractHtml,
new webpack.ProvidePlugin({
Promise: 'es6-promise',
fetch: 'imports-loader?this=>window!exports-loader?window.fetch!whatwg-fetch',
}),
new UglifyJSPlugin(),
],
};