diff --git a/packages/bridge/src/vite/server.ts b/packages/bridge/src/vite/server.ts index 354032a6a28..7ef61b3a200 100644 --- a/packages/bridge/src/vite/server.ts +++ b/packages/bridge/src/vite/server.ts @@ -38,10 +38,7 @@ export async function buildServer (ctx: ViteBuildContext) { }, cacheDir: resolve(ctx.nuxt.options.rootDir, 'node_modules/.cache/vite/server'), resolve: { - alias, - // By default Vite resolves `module` field, which not always a native ESM module - // Setting this option can bypass that and fallback to cjs version - mainFields: ctx.nuxt.options.dev ? ['main'] : undefined + alias }, ssr: { external: [ diff --git a/packages/vite/src/server.ts b/packages/vite/src/server.ts index 7f4f85d177b..18cf72cec8f 100644 --- a/packages/vite/src/server.ts +++ b/packages/vite/src/server.ts @@ -35,11 +35,7 @@ export async function buildServer (ctx: ViteBuildContext) { '@vue/shared': _resolve(`@vue/shared/dist/shared.cjs${ctx.nuxt.options.dev ? '' : '.prod'}.js`), 'vue-router': _resolve(`vue-router/dist/vue-router.cjs${ctx.nuxt.options.dev ? '' : '.prod'}.js`), vue: _resolve(`vue/dist/vue.cjs${ctx.nuxt.options.dev ? '' : '.prod'}.js`) - }, - // By default Vite resolves `module` field, which not always a native ESM module - // Setting this option can bypass that and fallback to cjs version - // TODO: Fix nitro/unenv issue with `main` field - mainFields: ctx.nuxt.options.dev ? ['main'] : undefined + } }, ssr: { external: [],