Skip to content

UXP Environment Cannot Resolve Rollup Code-Split Chunks #43

Description

@kernelKun886

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]'
      }
    }
  }
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions