Repository navigation
Expand file tree
/
Copy pathwebpack.config.js
More file actions
89 lines (88 loc) · 2.65 KB
/
Copy pathwebpack.config.js
File metadata and controls
89 lines (88 loc) · 2.65 KB
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
const path = require('path');
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
mode: 'development',
devtool: 'cheap-module-source-map',
entry: {
popup: './src/popup/index.tsx',
background: './src/background/background.ts',
contentScript: './src/content/contentScript.ts',
dashboard: './src/dashboard/index.tsx',
syntaxHighlight: './src/syntaxHighlightGlobal.ts',
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
clean: true,
},
module: {
rules: [
{
test: /\.tsx?$/,
use: [
{
loader: 'ts-loader',
options: {
configFile: 'tsconfig.json',
},
},
],
exclude: [/node_modules/, /website/],
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
{
test: /\.json$/,
type: 'json',
},
{
test: /\.wasm$/,
type: 'asset/resource',
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
fallback: {
"fs": false,
"path": false,
"crypto": false
}
},
plugins: [
// BSD-3-Clause requires the notice to ship with the binary. Terser extracts
// it into a .LICENSE.txt for the lazily-loaded editor chunks but drops it
// from the standalone syntaxHighlight entry, so state it explicitly there.
new webpack.BannerPlugin({
banner: [
'Bundles highlight.js - BSD-3-Clause',
'Copyright (c) 2006, Ivan Sagalaev. All rights reserved.',
'https://github.com/highlightjs/highlight.js/blob/main/LICENSE',
].join('\n'),
include: /^syntaxHighlight\.js$/,
}),
new CopyWebpackPlugin({
patterns: [
{ from: 'src/manifest.json', to: 'manifest.json' },
{ from: 'src/blocked.html', to: 'blocked.html' },
{ from: 'src/blocked.js', to: 'blocked.js' },
{ from: 'src/dashboard.html', to: 'dashboard.html' },
{ from: 'src/_locales/', to: '_locales/', noErrorOnMissing: false },
{ from: 'src/vendor/marked.js', to: 'vendor/marked.js' },
{ from: 'src/styles/', to: 'styles/', noErrorOnMissing: true },
{ from: 'src/vendor/', to: 'vendor/', noErrorOnMissing: true },
{ from: 'src/icons/', to: 'icons/', noErrorOnMissing: false },
{ from: 'node_modules/sql.js/dist/sql-wasm.wasm', to: 'sql-wasm.wasm' },
],
}),
new HtmlWebpackPlugin({
template: './src/popup/popup.html',
filename: 'popup.html',
chunks: ['popup'],
}),
],
};