Issue: UXP Environment Cannot Resolve Rollup Code-Split Chunks
Problem Description
When building a UXP plugin with Vite and Rollup code splitting, the generated chunks cannot be resolved properly in the UXP environment. The error occurs when the main entry file tries to import the vendor chunk:
uxp://uxp-internal/domjs_scripts.js:2 Uncaught Error: Module not found: "./vendor.js". Parent module folder was: "./"
Environment
- Build Tool: Vite
- UXP Plugin: vite-uxp-plugin
- Framework: Vue 3
- Code Splitting: Rollup manualChunks
Configuration
// vite.config.js
export default defineConfig({
build: {
rollupOptions: {
output: {
manualChunks: (id) => {
if (id.includes('node_modules')) {
return 'vendor';
}
},
format: 'cjs',
chunkFileNames: 'assets/[name].js',
entryFileNames: 'assets/[name].js',
assetFileNames: 'assets/[name][extname]'
}
}
}
});
Issue: UXP Environment Cannot Resolve Rollup Code-Split Chunks
Problem Description
When building a UXP plugin with Vite and Rollup code splitting, the generated chunks cannot be resolved properly in the UXP environment. The error occurs when the main entry file tries to import the vendor chunk:
uxp://uxp-internal/domjs_scripts.js:2 Uncaught Error: Module not found: "./vendor.js". Parent module folder was: "./"
Environment
Configuration