forked from anicolao/npa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.baseconfig.js
47 lines (45 loc) · 991 Bytes
/
webpack.baseconfig.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
import {fileURLToPath} from 'node:url';
import path from 'path';
import CopyPlugin from 'copy-webpack-plugin';
import { execaSync } from 'execa';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
export const common = {
entry: {
background: './src/background.js',
intel: './src/intel.ts',
},
module: {
rules: [
{
test: /\.(js|ts)x?$/,
use: ['ts-loader'],
exclude: /node_modules/,
sideEffects: false,
},
],
},
watchOptions: {
ignored: /version.js/,
},
resolve: {
extensions: ['.ts', '.js'],
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist'),
clean: false,
},
plugins: [
new CopyPlugin({
patterns: [{ from: 'static' }],
}),
{
apply: (compiler) => {
compiler.hooks.watchRun.tap('VersionPlugin', (compilation) => {
console.log("Run ./bin/version");
execaSync('./bin/version');
});
}
}
],
};