Skip to content
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

Is template-registry.js in publicEntrypoint correct? #252

Open
mkszepp opened this issue Feb 6, 2024 · 1 comment
Open

Is template-registry.js in publicEntrypoint correct? #252

mkszepp opened this issue Feb 6, 2024 · 1 comment

Comments

@mkszepp
Copy link
Contributor

mkszepp commented Feb 6, 2024

While addon converting to a V2 and adding glint i have seen, that the rollup script brings this warning Generated an empty chunk.

I have looked in other addons which are already converted and i have seen that some other addons has also this behavior.

../ember-file-upload prepare: [js]  → dist...
../ember-file-upload prepare: [js] (!) Generated an empty chunk
../ember-file-upload prepare: [js] "template-registry"

For example ember-file-upload (adopted-ember-addons/ember-file-upload#1067):
https://github.com/adopted-ember-addons/ember-file-upload/actions/runs/7606502732/job/20712414961#step:4:40

Also in ember ember-truth-helpers we have the same (jmurphyau/ember-truth-helpers#203):

In ember-page-title this line is not present, so also the empty file is not present on npm.. https://github.com/ember-cli/ember-page-title/blob/master/addon/rollup.config.mjs#L19-L24

This is cause by following line which is still present in the addon blueprint:

addon.publicEntrypoints(['**/*.js', 'index.js'<% if (typescript) {%>, 'template-registry.js'<% } %>]),

At the end we are shipping a empty template-registry.js to npm (https://www.npmjs.com/package/ember-file-upload?activeTab=code)
grafik

Is there any reason why template-registry.js was added in publicEntrypoints? Can we safely remove?

@NullVoxPopuli
Copy link
Collaborator

Is there any reason why template-registry.js was added in publicEntrypoints? Can we safely remove?

Mostly in that it's the easiest way to convert a template-registry.ts to a d.ts for residing in the declarations folder.

It's totally up to folks to manage that file a different way of course! Just remember to update package.json#exports for when you change the location / file type.

that the rollup script brings this warning Generated an empty chunk.

this is because it's usually a types only file, with no runtime code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants