-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathwebpack.config.ts
58 lines (55 loc) ยท 1.44 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
import path from 'node:path';
import { CleanWebpackPlugin } from 'clean-webpack-plugin';
import CopyPlugin from 'copy-webpack-plugin';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import { type Configuration } from 'webpack';
const NODE_ENV = process.env.NODE_ENV || 'development';
const IS_PROD = NODE_ENV === 'production';
const config: Configuration = {
mode: IS_PROD ? 'production' : 'development',
devtool: IS_PROD ? false : 'inline-source-map',
resolve: {
extensions: ['.css', '.js', '.jsx', '.ts', '.tsx'],
},
entry: {
app: './src/app.ts',
background: './src/background.ts',
popup: './src/popup.ts',
'content-main': './src/content-main.ts',
'content-style': './src/content-style.ts',
'content-video': './src/content-video.ts',
'video-viewer': './src/routes/video-viewer.ts',
dark: './src/styles/dark.scss',
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
},
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'sass-loader',
],
},
],
},
plugins: [
new CleanWebpackPlugin(),
new MiniCssExtractPlugin(),
new CopyPlugin({
patterns: [
{ from: 'public', to: '.' },
{ from: 'manifest.json', to: '.' },
],
}),
],
output: {
filename: '[name].js',
path: path.join(__dirname, 'dist'),
},
};
export default config;