embroider
embroider copied to clipboard
Convert @embroider/addon-dev to ESM
- Convert addon-dev to ESM ( 👈 you are here)
- ended up being required due to how
tscforbids ESM (even await import) in CJS-output (and we compile withtsc)- this came up because
fix-bad-declaration-outputis ESM only
- this came up because
- Compiled with SWC
- Do we need to generate types for everything? I saw only types for template-colocation-plugin were exported
- This'll be hard until the rest of the embroider packages are ESM, and we have a better way to provide "global types" for dependencies. For example,
@embroider/corerequres types forNestedHooks,beforeAll, etc, and those types don't exist in addon-dev -- nor do they make sense to exist. Maybe it makes more sense to get rid of those globals and define the types we need to use for those functions.
- This'll be hard until the rest of the embroider packages are ESM, and we have a better way to provide "global types" for dependencies. For example,
- ended up being required due to how
-
Add
addon.glint()utility to help out in the v2 addon blueprint- remove double package.json#scripts entries managed by concurrently
- better CLI output (two tools don't try to clear each other)
- work-around a couple problems with Glint (gts extensions, etc)
-
Remove the sample files
- with the package becoming type=module, the extensions needed to change / be consistent with type=module schemeing. I didn't see they were actually used though, so they've been removed.
I think you could use dynamic import inside closeBundle to not be blocked on esm conversion:
oh! that's a good idea! I always forget that's a thing. been so long since I've actually had to worry about cjs :sweat_smile:
Nevermind -- our build setup is removing all imports...........
Been trying a few different compilation techniques, and it seems that there is a lot of:
[!] SyntaxError: Named export 'readJsonSync' not found. The requested module 'fs-extra' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'fs-extra';
const { readJsonSync, writeJsonSync } = pkg;
style of errors, including from @embroider/core
woah, it's green