Skip to content

Commit

Permalink
chore: update webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
enncy committed Mar 25, 2022
1 parent 5a2e672 commit 27921d1
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 6 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
1.在任意的 [`网课平台`](#网课平台) 页面,打开 `开发者工具`,方法如下。

| 谷歌 chrome | 火狐 Firefox | 微软 Edge |
| :---------: | :----------: | :--------: |
| `F12` | `F12` | `Ctrl`+`i` |
| 谷歌 chrome | 火狐 Firefox | 微软 Edge |
| :---------: | :----------: | :------------------: |
| `F12` | `F12` | `Ctrl`+ `Shift` +`i` |

2.点击`开发者工具`上方的:`Console` 或者 `控制台`

Expand Down Expand Up @@ -61,7 +61,11 @@ var resource = (url) => fetch(url).then((res) => res.text());
> `缺点`:需要安装油猴拓展
1.安装油猴浏览器拓展 https://www.tampermonkey.net/
1.安装油猴浏览器拓展

- `官网` https://www.tampermonkey.net/
- `谷歌网上商店` [https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo](https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo)
- `Edge外接程序` [https://microsoftedge.microsoft.com/addons/detail/tampermonkey/iikmkjmpaadaobahmlepeloendndfphd?hl=zh-CN](https://microsoftedge.microsoft.com/addons/detail/tampermonkey/iikmkjmpaadaobahmlepeloendndfphd?hl=zh-CN)

2.打开右上角油猴浏览器拓展

Expand Down
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ocsjs",
"version": "3.1.5",
"version": "3.1.6",
"description": "ocs - online course script 在线网络课程辅助工具",
"main": "./dist/index.js",
"types": "./packages/scripts/lib/src/index.d.ts",
Expand All @@ -10,7 +10,10 @@
],
"scripts": {
"webpack": "webpack --config webpack.config.js",
"gulp": "gulp --allowEmpty"
"gulp": "gulp --allowEmpty",
"pub:patch": "pnpm gulp && npm version patch && npm publish",
"pub:minor": "pnpm gulp && npm version minor && npm publish",
"pub:major": "pnpm gulp && npm version major && npm publish"
},
"dependencies": {
"@playwright/test": "^1.18.1",
Expand All @@ -26,6 +29,7 @@
},
"devDependencies": {
"@types/node": "^17.0.16",
"css-loader": "^6.7.1",
"cz-conventional-changelog": "^3.3.0",
"del": "^6.0.0",
"electron": "^17.0.0",
Expand All @@ -36,6 +40,8 @@
"markdown-it": "12.3.2",
"nanoid": "3.1.31",
"node-forge": "1.0.0",
"style-loader": "^3.3.1",
"terser-webpack-plugin": "^5.3.1",
"webpack": "^5.69.0",
"webpack-cli": "^4.9.2"
},
Expand Down
21 changes: 21 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
const path = require("path");
const { BannerPlugin } = require("webpack");
const { name, license, author, version, homepage } = require("./package.json");
const TerserPlugin = require("terser-webpack-plugin");

const banner = `${name} ${version} (${homepage})
Copyright © ${author}
Licensed under ${license}`;

/**
* @type {import("webpack").Configuration[]}
Expand All @@ -12,6 +19,14 @@ module.exports = [
path: path.resolve(__dirname, "dist/js"),
library: "OCS",
},
optimization: {
minimizer: [
new TerserPlugin({
extractComments: false,
}),
],
},
plugins: [new BannerPlugin({ banner })],
},
{
mode: "production",
Expand All @@ -23,6 +38,12 @@ module.exports = [
},
optimization: {
minimize: false,
minimizer: [
new TerserPlugin({
extractComments: false,
}),
],
},
plugins: [new BannerPlugin({ banner })],
},
];

0 comments on commit 27921d1

Please sign in to comment.