Skip to content

Commit eb855e3

Browse files
authored
fix: load internal node modules without string raw (#2606)
resolves #2605
1 parent 837e354 commit eb855e3

File tree

1 file changed

+5
-1
lines changed
  • crates/cli-support/src/js

1 file changed

+5
-1
lines changed

crates/cli-support/src/js/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,11 @@ impl<'a> Context<'a> {
537537
imports.push_str(other)
538538
}
539539
}
540-
imports.push_str(" } = require(String.raw`");
540+
if module.starts_with(".") || PathBuf::from(module).is_absolute() {
541+
imports.push_str(" } = require(String.raw`");
542+
} else {
543+
imports.push_str(" } = require(`");
544+
}
541545
imports.push_str(module);
542546
imports.push_str("`);\n");
543547
}

0 commit comments

Comments
 (0)