2 Star 8 Fork 1

lisheng/Vue3 + element Plus 谷歌插件v3模版

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
vue.config.js 1.86 KB
一键复制 编辑 原始数据 按行查看 历史
lisheng 提交于 2023-04-26 10:11 . feat: 分块打包
const CopyWebpackPlugin = require("copy-webpack-plugin");
const path = require("path");
const packageName = "dist" // 定义项目打包后文件名
const ExtensionReloader = require('webpack-extension-reloader');
// 复制文件夹到指定目录
const copyFiles = [
{
from: path.resolve("src/manifest.json"),
to: `${path.resolve(packageName)}/manifest.json`
},
{
from: path.resolve("src/assets"),
to: path.resolve(packageName)
},
{
from: path.resolve("src/_locales"),
to: path.resolve(packageName + "/_locales")
}
];
// 复制插件
const plugins = [
new CopyWebpackPlugin({
patterns: copyFiles
}),
new ExtensionReloader({
reloadPage: true,
}),
];
module.exports = {
pages: {
popup: {
entry: `src/popup/main.js`,
template: `src/popup/index.html`,
filename: `popup.html`
}
},
productionSourceMap: false,
pluginOptions: {
browserExtension: {
componentOptions: {
background: {
entry: 'src/background/main.js'
},
contentScripts: {
entries: {
'content-script': [
'src/content-scripts/main.js'
]
}
}
}
}
},
// 根目录 如果不写 默认是dist
outputDir: __dirname + '/' + packageName,
configureWebpack: {
watch: true, // 自动打包
entry: {
content: "./src/content-scripts/main.js",
background: "./src/background/main.js"
},
output: {
filename: "js/[name].js"
},
plugins,
optimization: {
splitChunks: false,
},
// 打包文件大小配置
performance: {
maxEntrypointSize: 10000000,
maxAssetSize: 30000000
}
},
css: {
extract: {
filename: "css/[name].css"
}
},
chainWebpack: config => {
if (process.env.NODE_ENV === 'production') {
config.output.filename('js/[name].js').end()
config.output.chunkFilename('js/[name].js').end()
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lisheng-ls/chrome-plug-template.git
[email protected]:lisheng-ls/chrome-plug-template.git
lisheng-ls
chrome-plug-template
Vue3 + element Plus 谷歌插件v3模版
master

搜索帮助