-
-
Notifications
You must be signed in to change notification settings - Fork 669
Convert loader to ESM #1313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert loader to ESM #1313
Conversation
Well, seems TypeScript isn't happy with that in the bootstrap test. Also quickly looked up how to make a hybrid module, but that requires either transpiling, which is silly, or keeping the base code in CommonJS format, which isn't helpful in the browser. |
[insert random swearwords / honest opinion here] Looks like the only thing that'll actually work in all circumstances is to transpile, but pulling in potentially heavy dependencies like babel just for that feels wrong as well :( |
Why not go the whole nine yards and convert the loader to typescript? :) |
That's indeed another option given the circumstances. What I'm trying to achieve currently is that we have future proof sources in ESM, and would make the code base directly use the sources so making changes is immediately in sync without a build step, and contributors don't get confused by multiple files that look like sources. Then, if we absolutely need a build step, automate it on publish. For instance, with TypeScript we'll either have to ship both the TS sources and the transpiled files so stuff just works™ on clone but contributors will make changes to the wrong files or be otherwise confused, or we leave the transpiled files out of source control avoiding that but then people must build them after cloning :( |
Latest commit now gives this a shot using esm2umd as a prepublish step, making the loader default to ESM with UMD as a fallback. |
Superseded by #1513 |
This PR converts the loader to ESM format so it is more easily usable both on the web and under node.js. I stumbled over this while working on the new website and its editor, where I need a little hack to make the loader work. Of course that'd be easily fixable by appending an AMD/CommonJS shim, which I considered first, but with #1306 being a thing now (see for context) I figured that I can as well initiate the switch to ESM at the loader.
Thoughts? :)