-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.ts
63 lines (62 loc) · 1.54 KB
/
webpack.config.ts
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
import * as path from 'path';
import { ASSETS, DIST_FOLDER, SRC_FOLDER } from './webpack-plugins/utils';
import NunjucksBuild from './webpack-plugins/nunjucks-build';
import * as BrowserSyncPlugin from 'browser-sync-webpack-plugin';
const CopyPlugin = require('copy-webpack-plugin');
const compress = require('compression');
module.exports = (env: any, argv: any) => {
return {
mode: 'development',
devtool: 'inline-source-map',
entry: {
'base': [
'./src/index.ts',
],
},
module: {
rules: [
]
},
resolve: {
extensions: ['.ts', '.js']
},
output: {
},
devServer: {
static: path.join(__dirname, DIST_FOLDER),
hot: true,
},
plugins: [
new NunjucksBuild(),
new CopyPlugin({
patterns: ASSETS.map((asset) => {
return {
from: path.join(__dirname, SRC_FOLDER, asset),
to: path.join(__dirname, DIST_FOLDER, asset),
noErrorOnMissing: true,
};
}),
}),
// Browsersync for develpment server, only runs with --watch flag.
new BrowserSyncPlugin({
host: 'localhost',
port: 3000,
// proxy the Webpack Dev Server endpoint
// through BrowserSync
proxy: 'http://localhost:8080/',
notify: false,
middleware: [compress()],
reloadDelay: 200,
open: false,
}),
],
optimization: {
concatenateModules: false,
minimizer: [
],
},
performance: {
maxEntrypointSize: 512000,
},
};
};