lostintangent / codeswing

VS Code extension for building web applications ("swings") using a interactive and editor-integrated coding environment
https://aka.ms/codeswing
MIT License
978 stars 48 forks source link

Fixed imports when scriptType is module in codeswing.json #61

Closed ItalyPaleAle closed 2 years ago

ItalyPaleAle commented 2 years ago

This fixes an issue with scripts that rely on ESM were not working.

In case when a file has extension .js and scriptType is set to "module" in codeswing.json, before import statements were not replaced to use CDNJS (some heuristic was in place to make them work anyways if the file began with import, but not if the file didn't - such as if it started with a comment)