-
Notifications
You must be signed in to change notification settings - Fork 11
/
webpack.config.js
executable file
·100 lines (95 loc) · 2.2 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
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
const webpack = require('webpack');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const rel = function(p1) {
return path.resolve(__dirname, p1);
};
const CONTEXT = rel('.');
const ENGINE = rel('./engine');
const INTERFACE = rel('./interface');
const BUILD = rel('./build');
const ENGINE_WORKER = rel('./engine/worker/engine-worker.js');
const SUBWORKERS = rel('./engine/worker/subworkers.js');
const CANDIDATE_WORKER = rel('./engine/worker/candidate-worker.js');
module.exports = {
target: 'web',
profile: true,
cache: true,
devServer: {
contentBase: BUILD,
inline: true,
hot: true
},
node: {
global: false
},
//devtool: '#eval',
entry: {
'engine-worker': ENGINE_WORKER,
'candidate-worker': CANDIDATE_WORKER,
'subworkers': [SUBWORKERS],
'interface': INTERFACE
},
output: {
path: BUILD,
filename: '[name].js',
pathinfo: true
},
resolve: {
alias: {
context: CONTEXT,
engine: ENGINE,
interface: INTERFACE
},
extensions: ['.webpack-loader.js', '.web-loader.js',
'.loader.js', '.js', '.coffee', '.es6']
},
module: {
rules: [{
test: /\.coffee$/,
loader: 'coffee-loader'
}, {
test: /\.(?:pug|jade)$/,
loader: 'pug-loader'
}, {
test: /\.styl$/,
use: [
'style-loader',
'css-loader',
{
loader: 'stylus-loader',
options: {
use: [require('nib')()],
import: ['~nib/lib/nib/index.styl', rel('./config.styl')],
preferPathResolver: 'webpack'
}
}
]
}, {
test: /\.html$/,
loader: 'file-loader'
}, {
test: /\.txt$/,
loader: 'raw-loader'
}, {
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}]
},
plugins: [
new webpack.BannerPlugin({
banner: ';;(function(){this.global=this;this.window=this})();;',
raw: true,
entryOnly: true
}),
new HtmlWebpackPlugin({
title: 'TaylorFit',
chunks: ['interface', 'subworkers'],
template: './template/index.hbs'
})
]
};