generated from mizdra/webpack-ts-skeleton
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
45 lines (40 loc) · 1023 Bytes
/
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
/* eslint-env node */
const { resolve } = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const rootPath = resolve(__dirname, '.');
const srcPath = resolve(__dirname, './src');
const distPath = resolve(__dirname, './dist');
/** @type import('webpack').ConfigurationFactory */
module.exports = (env, argv) => ({
entry: {
background: [resolve(srcPath, './background/background.ts')],
content: [resolve(srcPath, './content/content.ts')],
},
output: {
path: distPath,
filename: 'js/[name].js',
},
devtool: 'inline-source-map',
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
options: {
transpileOnly: true,
},
},
],
},
resolve: {
extensions: ['.js', '.ts', '.tsx'],
},
plugins: [
new HtmlWebpackPlugin({
filename: resolve(distPath, './index.html'),
template: resolve(rootPath, 'index.html'),
chunks: ['content'],
scriptLoading: 'defer',
}),
],
});