diff --git a/README-zh_CN.md b/README-zh_CN.md index 4621165..bdfd1f1 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -57,7 +57,6 @@ vue add chrome-extension-cli ### 本地开发 跟 生产模式 - 使用` npm run build-watch`运行开发模式,将生成一个`dist`文件。 安装[Extension Reloader](https://chrome.google.com/webstore/detail/extensions-reloader/fimgfedafeadlieiabdeeaodndnlbhid),以便在热更新。 (注意,当您更改 manifest.json 文件时,它不会自动加载,您需要点选 extension 页面中的更新) -- ### manifest版本 3 不支援使用 `npm run build-watch` 因为 manifest版本 3不支援 [CSP](https://developer.chrome.com/docs/extensions/mv3/intro/mv3-migration/#content-security-policy) - 生产模式 `npm run build`,并将其压缩成 zip 并部署到 chrome 商店中。 ### prompts.js diff --git a/README-zh_TW.md b/README-zh_TW.md index 7835258..65d6986 100644 --- a/README-zh_TW.md +++ b/README-zh_TW.md @@ -57,7 +57,7 @@ vue add chrome-extension-cli ### 本地開發 跟 生產模式 - 使用` npm run build-watch`運行開發模式,將生成一個`dist`文件。 安裝[Extension Reloader](https://chrome.google.com/webstore/detail/extensions-reloader/fimgfedafeadlieiabdeeaodndnlbhid),以便在熱更新。 (注意,當您更改 manifest.json 文件時,它不會自動加載,您需要點選 extension 頁面中的更新) -- ### manifest版本 3 不支援使用 `npm run build-watch` 因為 manifest版本 3不支援 [CSP](https://developer.chrome.com/docs/extensions/mv3/intro/mv3-migration/#content-security-policy) + - 生產模式 `npm run build`,並將其壓縮成 zip 並部署到 chrome 商店中。 ### prompts.js diff --git a/README.md b/README.md index 670c8f2..57553e3 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ vue add chrome-extension-cli ### Run Development mode and Production - Run development mode with `npm run build-watch` and a `dist` file will be generated. Install [Extension Reloader](https://chrome.google.com/webstore/detail/extensions-reloader/fimgfedafeadlieiabdeeaodndnlbhid) to reload chrome extensions easily everytime you reload. (take note that when u change manifest.json file, it will not automatically load, you need to click update extension ) -- ### manifest_version 3 can't use `npm run build-watch` beacause version 3 can't support [CSP](https://developer.chrome.com/docs/extensions/mv3/intro/mv3-migration/#content-security-policy) + - Build for production `npm run build` and zip it and deploy onto chrome store. ### prompts.js diff --git a/generator/generate/editPackage.js b/generator/generate/editPackage.js index 00a8183..621e6a3 100644 --- a/generator/generate/editPackage.js +++ b/generator/generate/editPackage.js @@ -2,7 +2,7 @@ module.exports = (api, isTypeScript) => { const extPkg = { scripts: { - 'build-watch': 'vue-cli-service build-watch --mode development' + 'build-watch': 'vue-cli-service --env.NODE_ENV=development build-watch --mode development' }, devDependencies: { 'copy-webpack-plugin': '^4.6.0' diff --git a/generator/template/vue.config.js b/generator/template/vue.config.js index e63ca84..d07097b 100644 --- a/generator/template/vue.config.js +++ b/generator/template/vue.config.js @@ -25,6 +25,8 @@ chromeName.forEach((name) => { } }) +const isDevMode = process.env.NODE_ENV === 'development' + module.exports = { pages, filenameHashing: false, @@ -40,6 +42,7 @@ module.exports = { output: { filename: `js/[name].js`, chunkFilename: `[name].js` - } + }, + devtool: isDevMode ? 'inline-source-map' : false, } } diff --git a/package.json b/package.json index 0ad9a6a..92f6469 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-cli-plugin-chrome-extension-cli", - "version": "1.0.9", + "version": "1.1.0", "description": "Use Vue CLI generate chrome extension template | generate chrome extension with vue.js", "author": "sanyu1225 ", "scripts": {},