Skip to content

Commit a441ba5

Browse files
authored
fix: escape paths in injected imports (#78)
1 parent 5f591c5 commit a441ba5

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.changeset/tiny-tomatoes-switch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte-hmr': patch
3+
---
4+
5+
Fix injecting imports whose paths contain special characters

packages/svelte-hmr/lib/make-hot.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ const renderApplyHmr = ({
7575
preserveLocalState,
7676
emitCss,
7777
imports = [
78-
`import * as ${globalName} from '${hotApiImport}'`,
79-
`import { adapter as ${importAdapterName} } from '${adapterImport}'`,
78+
`import * as ${globalName} from ${JSON.stringify(hotApiImport)}`,
79+
`import { adapter as ${importAdapterName} } from ${JSON.stringify(adapterImport)}`,
8080
],
8181
}) =>
8282
// this silly formatting keeps all original characters in their position,

0 commit comments

Comments
 (0)