Skip to content

Commit

Permalink
test: update test code
Browse files Browse the repository at this point in the history
  • Loading branch information
yuuangzhang committed Nov 1, 2021
1 parent b2657ab commit 384da59
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
7 changes: 4 additions & 3 deletions packages/playground/ssr-vue/src/entry-server.js
@@ -1,10 +1,11 @@
import { createApp } from './main'
import { renderToString } from 'vue/server-renderer'
import path from 'path'
import path, { resolve } from 'path'
import assert from 'assert'

// test require relative path
const { foo } = require('../config')
// test require expression path
const cwd = process.env.JEST_WORKER_ID !== undefined ? resolve(process.cwd(), './packages/playground/ssr-vue') : process.cwd()
const { foo } = require(resolve(cwd, './config'))
assert.strictEqual(foo, 'foo')
// test require bare module
const serverRenderer = require('vue/server-renderer')
Expand Down
3 changes: 1 addition & 2 deletions packages/vite/src/node/ssr/ssrModuleLoader.ts
Expand Up @@ -122,9 +122,8 @@ async function instantiateModule(
return moduleGraph.urlToModuleMap.get(dep)?.ssrModule
}
const ssrRequire = (dep: string) => {
const { dirname } = path
return require(require.resolve(dep, {
paths: [dirname(mod.file!)]
paths: [path.dirname(mod.file!)]
}))
}

Expand Down

0 comments on commit 384da59

Please sign in to comment.