This repository has been archived by the owner on Jun 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.babel.js
105 lines (95 loc) · 2.12 KB
/
webpack.config.babel.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import path from 'path';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import HtmlWebpackPlugin from 'html-webpack-plugin';
const imageminOptions = {
progressive: true,
pngquant: {},
mozjpeg: {},
};
export default {
entry: ['babel-polyfill', './app/app'],
devtool: '#inline-source-map',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
},
module: {
loaders: [
{
test: /\.worker\.js$/,
loaders: [
'worker-loader',
],
},
{
test: /\.js$/,
exclude: /node_modules/,
loaders: [
'babel-loader',
'eslint-loader',
],
},
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
use: 'css-loader!csso-loader!postcss-loader!sass-loader',
}),
},
{
test: /\.(png|jpe?g|gif|svg)$/,
loaders: [
'file-loader?hash=sha256&digest=hex&name=[hash].[ext]',
`image-webpack-loader?${JSON.stringify(imageminOptions)}`,
],
},
{
test: /\.mp4$/,
loaders: [
'file-loader?hash=sha256&digest=hex&name=[hash].[ext]',
],
},
{
test: /\.ya?ml$/,
loader: [
'json-loader',
'yaml-loader',
],
},
{
test: /\.glsl$/,
loader: 'shader-loader',
options: {
glsl: {
chunkPath: path.resolve('app/shaders/chunks'),
},
},
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: '!!html-loader?attrs[]=:src!pug-html-loader?pretty&exports=false!./index.pug',
inject: 'head',
}),
new ExtractTextPlugin({
filename: '[hash].css',
allChunks: true,
}),
],
resolve: {
alias: {
styles: path.resolve(__dirname, 'app/styles'),
img: path.resolve(__dirname, 'img'),
},
},
devServer: {
contentBase: path.join(__dirname, 'dist'),
compress: true,
port: process.env.PORT || 8081,
host: '0.0.0.0',
disableHostCheck: true,
historyApiFallback: {
index: '/',
},
},
};