GithubHelp home page GithubHelp logo

Comments (5)

simonihmig avatar simonihmig commented on June 19, 2024 1

I might get confused having only worked on v2 addons for a while, but I do think that our current setup is the "blessed" one as Sander pointed out.

Compare this to e-c-ts docs and its precompile compile command (run as part of prepublish), which only creates declaration files, but doesn't compile down to JS.

v2 addons do the compilation upfront, as they have to. But I don't think it's worth our time to try to do this as a v1 addon. Also not sure if there is really much benefit, because our v1 addon's code still has to go through ember-cli-babel, with or without TS, and stripping the types away shouldn't be much additional work I think?

from ember-bootstrap.

SanderKnauff avatar SanderKnauff commented on June 19, 2024

For V1 addons, the addon controls it's own build behavior.
JS apps will defer the transpilation of the addon's Typescript to addon itself.

I've just tested this by creating a new JS Ember project and adding ember-bootstrap to it. Adding a bs-button just works as expected.

For a live demo, check out the component docs for BsButton. https://www.ember-bootstrap.com/components/button
Our docs app does not use Typescript yet, but the pages for the converted components still work.

from ember-bootstrap.

jelhan avatar jelhan commented on June 19, 2024

For V1 addons, the addon controls it's own build behavior.
JS apps will defer the transpilation of the addon's Typescript to addon itself.

Yes. But we don't have a dependency on ember-cli-typescript or typescript or any other package, which may handle the transpilation. That's why I'm surprised that it's working.

Even if we can delay transpilation to JS to build-time of consuming app with v1 addon, I don't think we should do so. It increases technical complexity and has a negative affect on build-time performance.

from ember-bootstrap.

SanderKnauff avatar SanderKnauff commented on June 19, 2024

For V1 addons, the addon controls it's own build behavior.
JS apps will defer the transpilation of the addon's Typescript to addon itself.

Yes. But we don't have a dependency on ember-cli-typescript or typescript or any other package, which may handle the transpilation. That's why I'm surprised that it's working.

Even if we can delay transpilation to JS to build-time of consuming app with v1 addon, I don't think we should do so. It increases technical complexity and has a negative affect on build-time performance.

I think it's just using ember-cli-babel for that. I do see that we don't pull in @babel/plugin-typescript-transform through the dependencies (only through devDependencies), but that package is so widely used in Ember related packages, especially the core ones, that I think most apps have it available through those.

Even if we can delay transpilation to JS to build-time of consuming app with v1 addon, I don't think we should do so. It increases technical complexity and has a negative affect on build-time performance.

That is a valid concern. I do think that most V1 Typescript addons keep the TS in place though. Should we try to precompile the js files and remove the Typescript files from the build bundle?

I really should dive back into the V2 addon stuff. For that one atleast I'm sure we should only ship compiled js (except for the types, ofcourse).

from ember-bootstrap.

jelhan avatar jelhan commented on June 19, 2024

Should we try to precompile the js files and remove the Typescript files from the build bundle?

I was surprised to see that this is not the standard. If it's not too much work, we should do it in my opinion. Maybe it's just about running tsc in prepack step and adding *.ts to .npmignore?

from ember-bootstrap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.