Я предполагал, что ManualChunks: () => Undefined делал магию, но он снова начинает создавать активы JS. config: < /p>
export default defineConfig(({mode}) => {
const env = loadEnv(mode, resolve(__dirname), '')
const version = env.VITE_APP_VERSION ?? '0.0.0'
return {
root: 'src',
envDir: resolve(__dirname),
publicDir: '../public',
plugins: [
react(),
tailwindcss(),
viteStaticCopy({
targets: [
// TODO: If we don't need it, we can remove it.
// { src: 'public/manifest.json', dest: '.' },
// { src: 'public/background.js', dest: '.' },
],
}),
{
name: 'generate-manifest-json',
apply: 'build',
closeBundle() {
const manifest = createManifest(version)
const out = path.resolve(__dirname, 'dist/manifest.json')
fs.mkdirSync(path.dirname(out), {recursive: true})
fs.writeFileSync(out, JSON.stringify(manifest, null, 2))
console.log('
},
}
],
build: {
rollupOptions: {
input: {
sidepanel: resolve(__dirname, 'src/sidepanel.html'),
content: resolve(__dirname, 'src/content/index.ts'),
background: resolve(__dirname, 'src/background/index.ts'),
},
output: {
entryFileNames: '[name].js',
// chunkFileNames: '[name].js',
// assetFileNames: '[name].[ext]',
manualChunks: () => undefined
},
},
outDir: '../dist',
emptyOutDir: true,
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
test: {
globals: true,
environment: 'jsdom',
},
}
})
Подробнее здесь: https://stackoverflow.com/questions/796 ... ts-in-vite
Мобильная версия