diff --git a/package.json b/package.json index 57bcfb8f..2318f55b 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { "name": "scriptcat", - "version": "0.15.1", + "version": "0.15.2", "description": "脚本猫,一个可以执行用户脚本的浏览器扩展,万物皆可脚本化,让你的浏览器可以做更多的事情!", "author": "CodFrm", "license": "GPLv3", "scripts": { "test": "jest --coverage", "lint": "eslint --ext .js,.ts,.tsx src/", - "dev": "concurrently \"webpack --mode development --config ./webpack/webpack.dev.ts\" \"webpack --mode development --config ./webpack/webpack.inject.ts\"", + "dev": "concurrently \"webpack --mode development --config ./webpack/webpack.dev.ts\" \"webpack --mode development --config ./webpack/webpack.inject.dev.ts\"", "build": "webpack --mode production --config ./webpack/webpack.prod.ts && concurrently \"npm run build:linter\" \"npm run build:inject && npm run build:no-split\"", "build:linter": "webpack --mode production --config ./webpack/webpack.linter.ts", "build:inject": "webpack --mode production --config ./webpack/webpack.inject.ts", diff --git a/src/manifest.json b/src/manifest.json index 95f20a7f..77180f78 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "ScriptCat", - "version": "0.15.1", + "version": "0.15.2", "author": "CodFrm", "description": "脚本猫,一个用户脚本管理器,支持后台脚本、定时脚本、页面脚本,可编写脚本每天帮你自动处理事务.", "options_ui": { diff --git a/webpack/webpack.inject.dev.ts b/webpack/webpack.inject.dev.ts new file mode 100644 index 00000000..7a34fe8d --- /dev/null +++ b/webpack/webpack.inject.dev.ts @@ -0,0 +1,38 @@ +/* eslint-disable import/no-extraneous-dependencies */ +import merge from "webpack-merge"; +import HtmlWebpackPlugin from "html-webpack-plugin"; +import CopyPlugin from "copy-webpack-plugin"; +import { CleanWebpackPlugin } from "clean-webpack-plugin"; +import common from "../webpack.config"; + +const src = `${__dirname}/../src`; +const dist = `${__dirname}/../dist`; + +// 不要分割的文件 +common.entry = { + inject: `${src}/inject.ts`, +}; + +common.output = { + path: `${dist}`, + filename: "[name].js", + clean: false, +}; + +// 取消splitChunks +common.optimization = {}; + +// 移除插件 +common.plugins = common.plugins!.filter( + (plugin) => + !( + plugin instanceof HtmlWebpackPlugin || + plugin instanceof CopyPlugin || + plugin instanceof CleanWebpackPlugin + ) +); + +export default merge(common, { + watch: true, + devtool: "inline-source-map", +}); diff --git a/webpack/webpack.inject.ts b/webpack/webpack.inject.ts index d9b060fb..8bdd939c 100644 --- a/webpack/webpack.inject.ts +++ b/webpack/webpack.inject.ts @@ -2,7 +2,6 @@ import merge from "webpack-merge"; import HtmlWebpackPlugin from "html-webpack-plugin"; import CopyPlugin from "copy-webpack-plugin"; -import CompressionPlugin from "compression-webpack-plugin"; import { CleanWebpackPlugin } from "clean-webpack-plugin"; import common from "../webpack.config"; @@ -33,12 +32,4 @@ common.plugins = common.plugins!.filter( ) ); -export default merge(common, { - plugins: [ - // firefox商店文件不能大于4M, 所以需要压缩 - new CompressionPlugin({ - test: /ts.worker.js/, - deleteOriginalAssets: true, - }), - ], -}); +export default merge(common, {});