Skip to content

Commit 3b6768c

Browse files
committed
chore: run prettier
1 parent 102451e commit 3b6768c

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

packages/vite/src/node/ssr/ssrModuleLoader.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { transformRequest } from '../server/transformRequest'
1616
// This is a workaround since typescript compiles dynamic imports to `require`.
1717
// Thankfully, when `typescript@4.5.0` lands it won't and this can be removed!
1818
// See #5197 for notes
19-
const nativeImport = eval('u => import(u)');
19+
const nativeImport = eval('u => import(u)')
2020

2121
interface SSRContext {
2222
global: NodeJS.Global
@@ -97,11 +97,7 @@ async function instantiateModule(
9797

9898
const ssrImport = async (dep: string) => {
9999
if (dep[0] !== '.' && dep[0] !== '/') {
100-
return nodeImport(
101-
dep,
102-
mod.file,
103-
server.config
104-
)
100+
return nodeImport(dep, mod.file, server.config)
105101
}
106102
dep = unwrapId(dep)
107103
if (!isCircular(dep) && !pendingImports.get(dep)?.some(isCircular)) {
@@ -183,32 +179,36 @@ async function instantiateModule(
183179
async function nodeImport(
184180
id: string,
185181
importer: string | null,
186-
config: ViteDevServer['config'],
182+
config: ViteDevServer['config']
187183
) {
188184
let url: string
189185
// `resolve` doesn't handle `node:` builtins, so handle them directly
190186
if (id.startsWith('node:') || isBuiltin(id)) {
191187
url = id
192188
} else {
193-
url = pathToFileURL(resolve(id, importer, config.root, !!config.resolve.preserveSymlinks)).toString()
189+
url = pathToFileURL(
190+
resolve(id, importer, config.root, !!config.resolve.preserveSymlinks)
191+
).toString()
194192
}
195-
const mod = await nativeImport(url);
196-
return proxyESM(id, mod);
193+
const mod = await nativeImport(url)
194+
return proxyESM(id, mod)
197195
}
198196

199197
// rollup-style default import interop for cjs
200198
function proxyESM(id: string, mod: any) {
201199
return new Proxy(mod, {
202200
get(mod, prop) {
203201
if (prop in mod) {
204-
return mod[prop];
202+
return mod[prop]
205203
}
206204
// commonjs interop: module whose exports are not statically analyzable
207205
if (isObject(mod.default) && prop in mod.default) {
208206
return mod.default[prop]
209207
}
210208
// throw an error like ESM import does
211-
throw new SyntaxError(`The requested module '${id}' does not provide an export named '${prop.toString()}'`)
209+
throw new SyntaxError(
210+
`The requested module '${id}' does not provide an export named '${prop.toString()}'`
211+
)
212212
}
213213
})
214214
}

0 commit comments

Comments
 (0)