diff --git a/package-lock.json b/package-lock.json index 6c88f6d4..a1028f00 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "scriptcat", - "version": "0.10.0-beta", + "version": "0.10.0-beta.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "scriptcat", - "version": "0.10.0-beta", + "version": "0.10.0-beta.1", "license": "GPLv3", "dependencies": { "@arco-design/web-react": "^2.40.2", @@ -59,6 +59,7 @@ "babel-loader": "^8.2.5", "clean-webpack-plugin": "^4.0.0", "compression-webpack-plugin": "^10.0.0", + "concurrently": "^7.5.0", "copy-webpack-plugin": "^11.0.0", "css-loader": "^6.7.1", "eslint": "^7.32.0", @@ -5691,6 +5692,118 @@ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" }, + "node_modules/concurrently": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-7.5.0.tgz", + "integrity": "sha512-5E3mwiS+i2JYBzr5BpXkFxOnleZTMsG+WnE/dCG4/P+oiVXrbmrBwJ2ozn4SxwB2EZDrKR568X+puVohxz3/Mg==", + "dev": true, + "dependencies": { + "chalk": "^4.1.0", + "date-fns": "^2.29.1", + "lodash": "^4.17.21", + "rxjs": "^7.0.0", + "shell-quote": "^1.7.3", + "spawn-command": "^0.0.2-1", + "supports-color": "^8.1.0", + "tree-kill": "^1.2.2", + "yargs": "^17.3.1" + }, + "bin": { + "conc": "dist/bin/concurrently.js", + "concurrently": "dist/bin/concurrently.js" + }, + "engines": { + "node": "^12.20.0 || ^14.13.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/open-cli-tools/concurrently?sponsor=1" + } + }, + "node_modules/concurrently/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/concurrently/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/concurrently/node_modules/chalk/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/concurrently/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/concurrently/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/concurrently/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/concurrently/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, "node_modules/confusing-browser-globals": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.11.tgz", @@ -6193,6 +6306,19 @@ "node": ">=12" } }, + "node_modules/date-fns": { + "version": "2.29.3", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.29.3.tgz", + "integrity": "sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==", + "dev": true, + "engines": { + "node": ">=0.11" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/date-fns" + } + }, "node_modules/dayjs": { "version": "1.11.5", "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.5.tgz", @@ -13444,6 +13570,15 @@ "queue-microtask": "^1.2.2" } }, + "node_modules/rxjs": { + "version": "7.5.7", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.7.tgz", + "integrity": "sha512-z9MzKh/UcOqB3i20H6rtrlaE/CgjLOvheWK/9ILrbhROGTweAi1BaFsTT9FbwZi5Trr1qNRs+MXkhmR06awzQA==", + "dev": true, + "dependencies": { + "tslib": "^2.1.0" + } + }, "node_modules/safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -13582,6 +13717,15 @@ "node": ">=8" } }, + "node_modules/shell-quote": { + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.4.tgz", + "integrity": "sha512-8o/QEhSSRb1a5i7TFR0iM4G16Z0vYB2OQVs4G3aAFXjn3T6yEx8AZxy1PgDF7I00LZHYA3WxaSYIf5e5sAX8Rw==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/side-channel": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", @@ -13732,6 +13876,12 @@ "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==" }, + "node_modules/spawn-command": { + "version": "0.0.2-1", + "resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2-1.tgz", + "integrity": "sha512-n98l9E2RMSJ9ON1AKisHzz7V42VDiBQGY6PB1BwRglz99wpVsSuGzQ+jOi6lFXBGVTCrRpltvjm+/XA+tpeJrg==", + "dev": true + }, "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -14340,6 +14490,15 @@ "node": ">=8" } }, + "node_modules/tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dev": true, + "bin": { + "tree-kill": "cli.js" + } + }, "node_modules/ts-jest": { "version": "28.0.8", "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-28.0.8.tgz", @@ -19869,6 +20028,85 @@ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" }, + "concurrently": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-7.5.0.tgz", + "integrity": "sha512-5E3mwiS+i2JYBzr5BpXkFxOnleZTMsG+WnE/dCG4/P+oiVXrbmrBwJ2ozn4SxwB2EZDrKR568X+puVohxz3/Mg==", + "dev": true, + "requires": { + "chalk": "^4.1.0", + "date-fns": "^2.29.1", + "lodash": "^4.17.21", + "rxjs": "^7.0.0", + "shell-quote": "^1.7.3", + "spawn-command": "^0.0.2-1", + "supports-color": "^8.1.0", + "tree-kill": "^1.2.2", + "yargs": "^17.3.1" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "dependencies": { + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, "confusing-browser-globals": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.11.tgz", @@ -20270,6 +20508,12 @@ } } }, + "date-fns": { + "version": "2.29.3", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.29.3.tgz", + "integrity": "sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==", + "dev": true + }, "dayjs": { "version": "1.11.5", "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.5.tgz", @@ -25602,6 +25846,15 @@ "queue-microtask": "^1.2.2" } }, + "rxjs": { + "version": "7.5.7", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.7.tgz", + "integrity": "sha512-z9MzKh/UcOqB3i20H6rtrlaE/CgjLOvheWK/9ILrbhROGTweAi1BaFsTT9FbwZi5Trr1qNRs+MXkhmR06awzQA==", + "dev": true, + "requires": { + "tslib": "^2.1.0" + } + }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -25714,6 +25967,12 @@ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" }, + "shell-quote": { + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.4.tgz", + "integrity": "sha512-8o/QEhSSRb1a5i7TFR0iM4G16Z0vYB2OQVs4G3aAFXjn3T6yEx8AZxy1PgDF7I00LZHYA3WxaSYIf5e5sAX8Rw==", + "dev": true + }, "side-channel": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", @@ -25837,6 +26096,12 @@ "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==" }, + "spawn-command": { + "version": "0.0.2-1", + "resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2-1.tgz", + "integrity": "sha512-n98l9E2RMSJ9ON1AKisHzz7V42VDiBQGY6PB1BwRglz99wpVsSuGzQ+jOi6lFXBGVTCrRpltvjm+/XA+tpeJrg==", + "dev": true + }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -26284,6 +26549,12 @@ "punycode": "^2.1.1" } }, + "tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dev": true + }, "ts-jest": { "version": "28.0.8", "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-28.0.8.tgz", diff --git a/package.json b/package.json index 4a348b64..d2e7a188 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,17 @@ { "name": "scriptcat", - "version": "0.10.0-beta", + "version": "0.10.0-beta.1", "description": "脚本猫,一个可以执行用户脚本的浏览器扩展,万物皆可脚本化,让你的浏览器可以做更多的事情!", "author": "CodFrm", "license": "GPLv3", "scripts": { "test": "jest --coverage", "lint": "eslint --ext .js,.ts,.tsx src/", - "dev": "webpack --mode development --config webpack.dev.ts", - "build": "webpack --mode production --config webpack.prod.ts && npm run build:no-split", - "build:no-split": "webpack --mode production --config webpack.no.split.ts", + "dev": "concurrently \"webpack --mode development --config ./webpack/webpack.dev.ts\" \"npm run dev:linter\"", + "build": "webpack --mode production --config ./webpack/webpack.prod.ts && concurrently \"npm run build:linter\" \"npm run build:no-split\"", + "build:linter": "webpack --mode production --config ./webpack/webpack.linter.ts", + "build:no-split": "webpack --mode production --config ./webpack/webpack.no.split.ts", + "dev:linter": "webpack --mode development --config ./webpack/webpack.linter.ts --watch", "pack": "node ./build/pack.js" }, "dependencies": { @@ -63,6 +65,7 @@ "babel-loader": "^8.2.5", "clean-webpack-plugin": "^4.0.0", "compression-webpack-plugin": "^10.0.0", + "concurrently": "^7.5.0", "copy-webpack-plugin": "^11.0.0", "css-loader": "^6.7.1", "eslint": "^7.32.0", diff --git a/src/app/const.ts b/src/app/const.ts index dc804f8d..e96475cb 100644 --- a/src/app/const.ts +++ b/src/app/const.ts @@ -1,4 +1,4 @@ -export const ExtVersion = "0.10.0-beta"; +export const ExtVersion = "0.10.0-beta.1"; export const Server = "https://sc.icodef.com/"; diff --git a/src/app/service/system/manager.ts b/src/app/service/system/manager.ts index 6cc59b0a..c6a39983 100644 --- a/src/app/service/system/manager.ts +++ b/src/app/service/system/manager.ts @@ -49,13 +49,13 @@ export class SystemManager extends Manager { chrome.tabs.create({ url: "https://docs.scriptcat.org/" }); } else if (details.reason === "update") { const version = semver.parse(ExtVersion); - if (version && version.prerelease) { + if (version && !version.prerelease) { chrome.tabs.create({ url: "https://docs.scriptcat.org/docs/change/", }); } else { chrome.tabs.create({ - url: "https://docs.scriptcat.org/docs/change/pre-release", + url: "https://docs.scriptcat.org/docs/change/pre-release/", }); } } diff --git a/src/manifest.json b/src/manifest.json index 3e8de99b..edd57c7a 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "ScriptCat", - "version": "0.10.0.1010", + "version": "0.10.0.1020", "author": "CodFrm", "description": "脚本猫,一个用户脚本管理器,支持后台脚本、定时脚本、页面脚本,可编写脚本每天帮你自动处理事务.", "options_ui": { diff --git a/webpack.config.ts b/webpack.config.ts index 3eac8a7b..2614fe54 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -8,7 +8,6 @@ import CopyPlugin from "copy-webpack-plugin"; import { CleanWebpackPlugin } from "clean-webpack-plugin"; import { presetAttributify, presetUno } from "unocss"; -const NodePolyfillPlugin = require("node-polyfill-webpack-plugin"); const UnoCSS = require("@unocss/webpack").default; const ProgressBarPlugin = require("progress-bar-webpack-plugin"); const MonacoLocalesPlugin = require("monaco-editor-locales-plugin"); @@ -124,7 +123,6 @@ const config: Configuration = { UnoCSS({ presets: [presetUno(), presetAttributify()], }), - new NodePolyfillPlugin(), ], resolve: { extensions: [".js", ".ts", ".tsx", ".d.ts", ".tpl"], @@ -132,7 +130,6 @@ const config: Configuration = { "@App": path.resolve(__dirname, "src/"), "@Pkg": path.resolve(__dirname, "pkg/"), }, - mainFields: ["browser", "main", "module"], }, module: { rules: [ diff --git a/webpack.dev.ts b/webpack/webpack.dev.ts similarity index 86% rename from webpack.dev.ts rename to webpack/webpack.dev.ts index 0005f3b6..91fc5fe2 100644 --- a/webpack.dev.ts +++ b/webpack/webpack.dev.ts @@ -1,16 +1,15 @@ /* eslint-disable import/no-extraneous-dependencies */ import merge from "webpack-merge"; import CompressionPlugin from "compression-webpack-plugin"; -import common from "./webpack.config"; +import common from "../webpack.config"; -const src = `${__dirname}/src`; +const src = `${__dirname}/../src`; common.entry = { // @ts-ignore ...common.entry, content: `${src}/content.ts`, inject: `${src}/inject.ts`, - "linter.worker": `${src}/linter.worker.ts`, "editor.worker": "monaco-editor/esm/vs/editor/editor.worker.js", "ts.worker": "monaco-editor/esm/vs/language/typescript/ts.worker.js", }; diff --git a/webpack/webpack.linter.ts b/webpack/webpack.linter.ts new file mode 100644 index 00000000..54ab5ce2 --- /dev/null +++ b/webpack/webpack.linter.ts @@ -0,0 +1,32 @@ +/* eslint-disable import/no-extraneous-dependencies */ +import merge from "webpack-merge"; +import common from "../webpack.config"; + +const NodePolyfillPlugin = require("node-polyfill-webpack-plugin"); + +const src = `${__dirname}/../src`; +const dist = `${__dirname}/../dist`; + +// eslint文件 +common.entry = { + "linter.worker": `${src}/linter.worker.ts`, +}; + +common.output = { + path: `${dist}/ext/src`, + filename: "[name].js", + clean: false, +}; + +// 取消splitChunks +common.optimization = {}; + +// 移除插件 +common.plugins = []; + +export default merge(common, { + plugins: [new NodePolyfillPlugin()], + resolve: { + mainFields: ["browser", "main", "module"], + }, +}); diff --git a/webpack.no.split.ts b/webpack/webpack.no.split.ts similarity index 74% rename from webpack.no.split.ts rename to webpack/webpack.no.split.ts index 5150045e..02334f69 100644 --- a/webpack.no.split.ts +++ b/webpack/webpack.no.split.ts @@ -1,19 +1,18 @@ /* eslint-disable import/no-extraneous-dependencies */ import merge from "webpack-merge"; -import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer"; 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"; +import common from "../webpack.config"; -const src = `${__dirname}/src`; -const dist = `${__dirname}/dist`; +const src = `${__dirname}/../src`; +const dist = `${__dirname}/../dist`; +// 不要分割的文件 common.entry = { content: `${src}/content.ts`, inject: `${src}/inject.ts`, - "linter.worker": `${src}/linter.worker.ts`, "editor.worker": "monaco-editor/esm/vs/editor/editor.worker.js", "ts.worker": "monaco-editor/esm/vs/language/typescript/ts.worker.js", }; @@ -39,11 +38,6 @@ common.plugins = common.plugins!.filter( export default merge(common, { plugins: [ - new BundleAnalyzerPlugin({ - analyzerMode: "static", - openAnalyzer: false, - reportFilename: "../../report/bundle-analyzer.html", - }), // firefox商店文件不能大于4M, 所以需要压缩 new CompressionPlugin({ test: /ts.worker.js/, diff --git a/webpack.prod.ts b/webpack/webpack.prod.ts similarity index 90% rename from webpack.prod.ts rename to webpack/webpack.prod.ts index f21ccb8e..802d1022 100644 --- a/webpack.prod.ts +++ b/webpack/webpack.prod.ts @@ -1,7 +1,7 @@ /* eslint-disable import/no-extraneous-dependencies */ import merge from "webpack-merge"; import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer"; -import common from "./webpack.config"; +import common from "../webpack.config"; export default merge(common, { plugins: [