-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
51 lines (49 loc) · 1.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
/* eslint-disable @typescript-eslint/no-var-requires */
const HtmlWebpackPlugin = require('html-webpack-plugin');
const WorkerPlugin = require('worker-plugin');
/* eslint-enable @typescript-eslint/no-var-requires */
const { DIR, EXT = 'ts' } = process.env;
module.exports = {
mode: 'development',
devtool: 'cheap-module-eval-source-map',
entry: `./examples/${DIR}/src/index.${EXT}`,
output: {
publicPath: '/',
},
plugins: [
new HtmlWebpackPlugin({
template: `./examples/${DIR}/public/index.html`,
}),
new WorkerPlugin(),
],
module: {
rules: [{
test: /\.ts$/,
loader: 'ts-loader',
options: {
transpileOnly: true,
},
}, {
test: /\.svelte$/,
use: {
loader: 'svelte-loader',
options: {
hotReload: true,
},
},
}],
},
resolve: {
alias: {
svelte: `${__dirname}/node_modules/svelte`,
'svelte3-redux': `${__dirname}/src`,
},
extensions: ['.mjs', '.js', '.ts', '.svelte'],
mainFields: ['svelte', 'browser', 'module', 'main'],
},
devServer: {
port: process.env.PORT || '8080',
contentBase: `./examples/${DIR}/public`,
historyApiFallback: true,
},
};