embroider-build / addon-blueprint

Blueprint for v2-formatted Ember addons
MIT License
28 stars 23 forks source link

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

Open mkszepp opened 5 months ago

mkszepp commented 5 months ago

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 (https://github.com/adopted-ember-addons/ember-file-upload/issues/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 (https://github.com/jmurphyau/ember-truth-helpers/pull/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: https://github.com/embroider-build/addon-blueprint/blob/b1168b4616adf748bd713c5af39e104325982e9b/files/__addonLocation__/rollup.config.mjs#L23

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 commented 5 months ago

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.