1 Star 0 Fork 0

chonglinghuc/report-render-chrome-plugin

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
vite.content.config.js 1.21 KB
一键复制 编辑 原始数据 按行查看 历史
卧梅又闻花 提交于 2023-08-20 23:07 . upload
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import { CRX_CONTENT_OUTDIR } from './globalConfig'
// https://vitejs.dev/config/
export default defineConfig({
build: {
// 输出目录
outDir: CRX_CONTENT_OUTDIR,
lib: {
entry: [path.resolve(__dirname, 'src/content/index.js')],
// content script不支持ES6,因此不用使用es模式,需要改为cjs模式
formats: ['cjs'],
// 设置生成文件的文件名
fileName: () => {
// 将文件后缀名强制定为js,否则会生成cjs的后缀名
return 'content.js'
},
},
rollupOptions: {
output: {
assetFileNames: (assetInfo) => {
// 附属文件命名,content script会生成配套的css
return 'content.css'
},
},
},
},
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
},
},
// 解决代码中包含process.env.NODE_ENV导致无法使用的问题
define: {
'process.env.NODE_ENV': null,
},
plugins: [vue()],
})
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/chonglinghuc/report-render-chrome-plugin.git
git@gitee.com:chonglinghuc/report-render-chrome-plugin.git
chonglinghuc
report-render-chrome-plugin
report-render-chrome-plugin
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385