Skip to content

Commit

Permalink
fix: enable vue-resolution workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Feb 10, 2022
1 parent a10b845 commit 17c3c60
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions src/rollup/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// import { pathToFileURL } from 'url'
// import { createRequire } from 'module'
import { createRequire } from 'module'
import { dirname, join, relative, resolve } from 'pathe'
import type { InputOptions, OutputOptions } from 'rollup'
import defu from 'defu'
Expand Down Expand Up @@ -43,18 +43,18 @@ export const getRollupConfig = (nitro: Nitro) => {
debug: 'unenv/runtime/npm/debug',
consola: 'unenv/runtime/npm/consola',
// // Vue 2
// encoding: 'unenv/runtime/mock/proxy',
// he: 'unenv/runtime/mock/proxy',
// resolve: 'unenv/runtime/mock/proxy',
// 'source-map': 'unenv/runtime/mock/proxy',
// 'lodash.template': 'unenv/runtime/mock/proxy',
// 'serialize-javascript': 'unenv/runtime/mock/proxy',
encoding: 'unenv/runtime/mock/proxy',
he: 'unenv/runtime/mock/proxy',
resolve: 'unenv/runtime/mock/proxy',
'source-map': 'unenv/runtime/mock/proxy',
'lodash.template': 'unenv/runtime/mock/proxy',
'serialize-javascript': 'unenv/runtime/mock/proxy',
// // Vue 3
// 'estree-walker': 'unenv/runtime/mock/proxy',
// '@babel/parser': 'unenv/runtime/mock/proxy',
// '@vue/compiler-core': 'unenv/runtime/mock/proxy',
// '@vue/compiler-dom': 'unenv/runtime/mock/proxy',
// '@vue/compiler-ssr': 'unenv/runtime/mock/proxy',
'estree-walker': 'unenv/runtime/mock/proxy',
'@babel/parser': 'unenv/runtime/mock/proxy',
'@vue/compiler-core': 'unenv/runtime/mock/proxy',
'@vue/compiler-dom': 'unenv/runtime/mock/proxy',
'@vue/compiler-ssr': 'unenv/runtime/mock/proxy',
...nitro.options.alias
}
}
Expand All @@ -66,12 +66,10 @@ export const getRollupConfig = (nitro: Nitro) => {
}

// TODO: #590
// const _require = createRequire(import.meta.url)
// if (nitro.options.majorVersion === 3) {
// env.alias['vue/server-renderer'] = 'vue/server-renderer'
// env.alias['vue/compiler-sfc'] = 'vue/compiler-sfc'
// env.alias.vue = _require.resolve(`vue/dist/vue.cjs${nitro.options.dev ? '' : '.prod'}.js`)
// }
const _require = createRequire(import.meta.url)
env.alias['vue/server-renderer'] = 'vue/server-renderer'
env.alias['vue/compiler-sfc'] = 'vue/compiler-sfc'
env.alias.vue = _require.resolve(`vue/dist/vue.cjs${nitro.options.dev ? '' : '.prod'}.js`)

const buildServerDir = join(nitro.options.buildDir, 'dist/server')
const runtimeAppDir = join(runtimeDir, 'app')
Expand Down

0 comments on commit 17c3c60

Please sign in to comment.