Skip to content

Commit a96ab94

Browse files
committed
🐛 修复新的注入方式导致dev模式无法正常运行的问题
1 parent 4cf6450 commit a96ab94

File tree

4 files changed

+42
-13
lines changed

4 files changed

+42
-13
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "scriptcat",
3-
"version": "0.15.1",
3+
"version": "0.15.2",
44
"description": "脚本猫,一个可以执行用户脚本的浏览器扩展,万物皆可脚本化,让你的浏览器可以做更多的事情!",
55
"author": "CodFrm",
66
"license": "GPLv3",
77
"scripts": {
88
"test": "jest --coverage",
99
"lint": "eslint --ext .js,.ts,.tsx src/",
10-
"dev": "concurrently \"webpack --mode development --config ./webpack/webpack.dev.ts\" \"webpack --mode development --config ./webpack/webpack.inject.ts\"",
10+
"dev": "concurrently \"webpack --mode development --config ./webpack/webpack.dev.ts\" \"webpack --mode development --config ./webpack/webpack.inject.dev.ts\"",
1111
"build": "webpack --mode production --config ./webpack/webpack.prod.ts && concurrently \"npm run build:linter\" \"npm run build:inject && npm run build:no-split\"",
1212
"build:linter": "webpack --mode production --config ./webpack/webpack.linter.ts",
1313
"build:inject": "webpack --mode production --config ./webpack/webpack.inject.ts",

src/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 2,
33
"name": "ScriptCat",
4-
"version": "0.15.1",
4+
"version": "0.15.2",
55
"author": "CodFrm",
66
"description": "脚本猫,一个用户脚本管理器,支持后台脚本、定时脚本、页面脚本,可编写脚本每天帮你自动处理事务.",
77
"options_ui": {

webpack/webpack.inject.dev.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/* eslint-disable import/no-extraneous-dependencies */
2+
import merge from "webpack-merge";
3+
import HtmlWebpackPlugin from "html-webpack-plugin";
4+
import CopyPlugin from "copy-webpack-plugin";
5+
import { CleanWebpackPlugin } from "clean-webpack-plugin";
6+
import common from "../webpack.config";
7+
8+
const src = `${__dirname}/../src`;
9+
const dist = `${__dirname}/../dist`;
10+
11+
// 不要分割的文件
12+
common.entry = {
13+
inject: `${src}/inject.ts`,
14+
};
15+
16+
common.output = {
17+
path: `${dist}`,
18+
filename: "[name].js",
19+
clean: false,
20+
};
21+
22+
// 取消splitChunks
23+
common.optimization = {};
24+
25+
// 移除插件
26+
common.plugins = common.plugins!.filter(
27+
(plugin) =>
28+
!(
29+
plugin instanceof HtmlWebpackPlugin ||
30+
plugin instanceof CopyPlugin ||
31+
plugin instanceof CleanWebpackPlugin
32+
)
33+
);
34+
35+
export default merge(common, {
36+
watch: true,
37+
devtool: "inline-source-map",
38+
});

webpack/webpack.inject.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import merge from "webpack-merge";
33
import HtmlWebpackPlugin from "html-webpack-plugin";
44
import CopyPlugin from "copy-webpack-plugin";
5-
import CompressionPlugin from "compression-webpack-plugin";
65
import { CleanWebpackPlugin } from "clean-webpack-plugin";
76
import common from "../webpack.config";
87

@@ -33,12 +32,4 @@ common.plugins = common.plugins!.filter(
3332
)
3433
);
3534

36-
export default merge(common, {
37-
plugins: [
38-
// firefox商店文件不能大于4M, 所以需要压缩
39-
new CompressionPlugin({
40-
test: /ts.worker.js/,
41-
deleteOriginalAssets: true,
42-
}),
43-
],
44-
});
35+
export default merge(common, {});

0 commit comments

Comments
 (0)