forked from CodFrm/cxmooc-tools
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathwebpack.config.js
76 lines (76 loc) · 2.41 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
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
const path = require('path');
const webpack = require('webpack');
const htmlWebpackPlugin = require('html-webpack-plugin');
const wasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");
const { VueLoaderPlugin } = require('vue-loader')
const home = __dirname + '/src';
module.exports = {
entry: {
mooc: home + '/mooc.ts',
start: home + '/start.ts',
background: home + '/background.ts',
popup: home + '/views/popup.ts'
},
output: {
path: __dirname + '/build/cxmooc-tools/src',
filename: '[name].js'
},
devtool: "source-map", // eval string is not permitted in manifest_v3 extensions
plugins: [
new htmlWebpackPlugin({
filename: __dirname + '/build/cxmooc-tools/src/popup.html',
template: home + '/views/popup.html',
inject: 'head',
title: '弹出页面',
minify: {
removeComments: true
},
chunks: ['popup']
}),
new wasmPackPlugin({
crateDirectory: path.resolve(__dirname, "../chaoxing-rs/fxxkmod"),
outDir: "../../cxmooc-tools/src/fxxkmod",
extraArgs: "--target web",
}),
new webpack.DefinePlugin({
global: 'window', // Placeholder for global used in any node_modules
__VUE_OPTIONS_API__: true, // (enable/disable Options API support, default: true)
__VUE_PROD_DEVTOOLS__: false, // (enable/disable devtools support in production, default: false)
}),
new VueLoaderPlugin()
],
module: {
rules: [
{
test: /\.css$/,
use: [
'css-loader',
],
}, {
test: /\.ts$/,
loader: 'ts-loader',
exclude: /node_modules/,
options: { appendTsSuffixTo: [/\.vue$/] },
}, {
test: /\.vue$/,
loader: 'vue-loader',
// options: {
// hotReload: false
// }
}, {
test: /\.wasm$/,
type: "asset/inline",
}
]
},
experiments: {
syncWebAssembly: true
},
resolve: {
extensions: ['.ts', '.js', '.wasm'],
alias: {
"@App": path.resolve(__dirname, 'src/'),
'vue': 'vue/dist/vue.esm-bundler.js',
}
}
};