embroider-build / embroider

Compiling Ember apps into spec-compliant, modern Javascript.
MIT License
339 stars 137 forks source link

[addon-dev] Allow TS files in publicEntrypoints / appReexports #1094

Closed josemarluedke closed 2 years ago

josemarluedke commented 2 years ago

For addons authoring their code in TS (or soon gjs/gts), currently is not possible to use @embroider/addon-dev's publicEntrypoints or appReexports methods.

We cannot use them because the dist files will end up with the same extension as the input.

In glimmer-apollo, I ended up doing a simple replace of .ts with .js.

https://github.com/josemarluedke/glimmer-apollo/blob/main/packages/glimmer-apollo/rollup.config.js#L7-L23

NullVoxPopuli commented 2 years ago

It turns out this isn't needed - stay tuned!

NullVoxPopuli commented 2 years ago

I think the solution in #1099 is solid~ish, but I need to figure out a peerDep issue -- https://github.com/embroider-build/embroider/issues/1062 I think I'm getting two copies of xstate in the consuming app, and it's only revealing itself because of component-manager's reliance on object identity. :thinking:

rwjblue commented 2 years ago

@josemarluedke - Can you put up a separate (smaller) PR from #1099 that ensures that the output path is .js similar to what you did here (though with more robust extension replacement support probably)?

josemarluedke commented 2 years ago

@rwjblue Can definitely do it. Should extension replacement support the following mapping?

rwjblue commented 2 years ago

yep! but I think we already have hbs -> js done right?

https://github.com/embroider-build/embroider/blob/7eba4a926fca45655ec13f5541e2ed964936bf88/packages/addon-dev/src/rollup-hbs-plugin.ts#L17-L20

josemarluedke commented 2 years ago

@rwjblue PR here: https://github.com/embroider-build/embroider/pull/1106