Skip to content

Commit dbd8e54

Browse files
committed
one more test
1 parent 2281311 commit dbd8e54

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts

+13
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,19 @@ test('hoist import to top', async () => {
184184
)
185185
})
186186

187+
test('do not hoist import if only whitespace is between them', async () => {
188+
expect(
189+
await ssrTransformSimpleCode(
190+
`import { dirname } from 'node:path';\n\n\nimport fs from 'node:fs';`,
191+
),
192+
).toMatchInlineSnapshot(`
193+
"const __vite_ssr_import_0__ = await __vite_ssr_import__("node:path", {"importedNames":["dirname"]});
194+
195+
196+
const __vite_ssr_import_1__ = await __vite_ssr_import__("node:fs", {"importedNames":["default"]});"
197+
`)
198+
})
199+
187200
test('preserve line offset when rewriting imports', async () => {
188201
// The line number of each non-import statement must not change.
189202
const inputLines = [

0 commit comments

Comments
 (0)