Skip to content

Commit 5a64ef9

Browse files
committed
Replace all import paths in runtime files .js -> .mjs
We rename the extension when copying runtime js files over, so we need to massage the imports/exports to comply.
1 parent ed755e1 commit 5a64ef9

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

sknpm/src/main.sk

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,7 @@ fun copyAndConvertImport(
908908
optCategory: ?String = None();
909909
lines = contents.split("\n").map(line -> {
910910
if (line.startsWith("import ") || line.startsWith("export {")) {
911+
!line = line.replace(".js", ".mjs");
911912
elements = line.split(" from ");
912913
if (elements.size() == 2) {
913914
imported = elements[1].split("\"");
@@ -916,11 +917,7 @@ fun copyAndConvertImport(
916917
size = elems.size();
917918
if (size > 1 && elems[0].startsWith("#")) {
918919
!elems = elems.mapWithIndex((idx, v) ->
919-
if (idx == 0) "." else if (idx == size - 1) {
920-
`${v}.mjs`
921-
} else {
922-
v
923-
}
920+
if (idx == 0) "." else v
924921
);
925922
!line = `${elements[0]} from "${elems.join("/")}"`
926923
}

0 commit comments

Comments
 (0)