Skip to content

Mark dependencies as external and revert to outputting CJS only#418

Merged
NullVoxPopuli merged 5 commits intomainfrom
external-deps
Dec 11, 2025
Merged

Mark dependencies as external and revert to outputting CJS only#418
NullVoxPopuli merged 5 commits intomainfrom
external-deps

Conversation

@evoactivity
Copy link
Copy Markdown
Member

@evoactivity evoactivity commented Dec 11, 2025

Bundling the prettier plugins meant we were building this plugin with versions of those prettier plugins from the latest prettier. People supplying older prettier's as a peer dep could then run into problems when those plugin implementations diverged.

Bundling all of @babel/core seems like a mistake to me.

Before marking these as external

dist/prettier-plugin-ember-template-tag.js   3,007.06 kB │ gzip: 580.70 kB
dist/prettier-plugin-ember-template-tag.cjs  3,007.10 kB │ gzip: 580.72 kB

after

dist/prettier-plugin-ember-template-tag.js   12.60 kB │ gzip: 3.51 kB
dist/prettier-plugin-ember-template-tag.cjs  12.63 kB │ gzip: 3.52 kB

The prettier parsing plugins are CJS in certain versions, building this as esm and cjs doesn't help as prettier uses import() to load plugins, so our esm version is always loaded and then we try to import the cjs plugins through named exports, which does not work.

Fixes #417

@evoactivity evoactivity changed the title Mark dependencies as external Mark dependencies as external and revert to outputting CJS only Dec 11, 2025
@evoactivity evoactivity added the bug Something isn't working label Dec 11, 2025
@NullVoxPopuli
Copy link
Copy Markdown
Member

Some context

#368 (review)

@evoactivity
Copy link
Copy Markdown
Member Author

Yeah I'm a fan of bundling in general, but I think the prettier plugins were bundled by mistake rather than intentionally.
An argument could be made to still bundle babel, and if we do decide to bundle it again I would suggest we move to @babel/traverse as I think that's the only thing we're using.

@NullVoxPopuli NullVoxPopuli merged commit 0ee97af into main Dec 11, 2025
14 checks passed
@NullVoxPopuli NullVoxPopuli deleted the external-deps branch December 11, 2025 15:32
@github-actions github-actions Bot mentioned this pull request Nov 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] v2.1.2: TypeError: undefined is not iterable

2 participants