ESM imports and .mjs issues

Hi, I hope you’ve been well!

We are migrating a project from classic to ESM, but we are having some issues with .mjs files and imports and we need some help. We’ve tried two different approaches, Import Map and direct paths.

Import Map appears work exclusively for external links. Internal project file imports always fail to be recognized through this method.


Meanwhile, using direct paths seems to work for some files, but not others.


Whether the imported files have errors or not doesn’t seem to consistently affect the outcome, but I feel I should mention that for some files, parsing in the editor points to errors in multiple (sometimes unrelated) files, errors which upon investigation lead nowhere. Unsure if this is related or not to the failed imports.

It could be a red herring as there are many more issues overall still (see below), but I am trying to find a path through all these errors and I thought this might be a lead.

If you can help us out in anyway please let me know! I’ll be very thankful.

@KPal / @abstrakt ?

Update: Some of these issues seem to happen when a .js or .mjs file is renamed. Deleting and recreating the broken file fixes the editor ‘parse’ issue, but not always the import issue.

The import errors are a bit more unpredictable and I am still trying to clean up the project to see if I can figure that out.