Giter Site home page Giter Site logo

Suggestion: swc about bundler HOT 11 CLOSED

timreichen avatar timreichen commented on May 28, 2024 2
Suggestion: swc

from bundler.

Comments (11)

timreichen avatar timreichen commented on May 28, 2024 1

@shadowtime2000 A few reasons:

  1. Deno.emit will bundle all resources together into one file. If there are multiple entry files that share dependencies, there will be duplicate code. I think a better way in browsers is to allow for code splitting explained here, which is not currently possible with Deno.emit.
  2. Since this bundler supports different file types such as images, css and html etc., the correct output paths need to be injected, which is done by a typescript transformer. Deno.emit does not allow transformer hooks as of now.
  3. Deno.emit does not use system modules anymore, though browsers do not yet support top level await.

But I am playing with the idea of using Deno.bundle if none of the upper arguments apply.

from bundler.

timreichen avatar timreichen commented on May 28, 2024 1

No that was a good question. I asked on deno discord about a transfomer option for Deno.emit, seems to have gone lost. I would like to use either Deno.emit rather than the ts module, so if that became a thing I'd gladly switch.

from bundler.

ije avatar ije commented on May 28, 2024

wish deno openPlugin become stable ASAP

from bundler.

timreichen avatar timreichen commented on May 28, 2024

possible solution once feature-rich and stable: https://github.com/nestdotland/deno_swc/actions

from bundler.

AndiLavera avatar AndiLavera commented on May 28, 2024

Any progress on this?

from bundler.

timreichen avatar timreichen commented on May 28, 2024

Not yet sadly. Seems like the deno_swc rep hasn't been updated for months and before a switch, I would need some help to determine if all features are available. For example: How would transforming ts code to system (like in module:system in ts compilerOptions) work with swc? I never used swc myself and would need some help on this.

from bundler.

shadowtime2000 avatar shadowtime2000 commented on May 28, 2024

Any reason for not using Deno.emit with not setting bundle to just transpile the code @timreichen?

from bundler.

shadowtime2000 avatar shadowtime2000 commented on May 28, 2024

@timreichen Makes sense, but you can disable bundling with Deno.emit so that it only transpiles TS.

from bundler.

timreichen avatar timreichen commented on May 28, 2024

Yes but I need the ts compiler to be able to do more than just transpile ts to js. There is a lot of ast manipulation going on for injecting paths and import statements etc.
What would the advantage of using Deno.emit be? I still would need to use a ast walker parallel to that.

from bundler.

shadowtime2000 avatar shadowtime2000 commented on May 28, 2024

@timreichen Fair point. I wasn't arguing with you, just pointing out that your first point about bundling didn't work 😄

from bundler.

timreichen avatar timreichen commented on May 28, 2024

possible solution once feature-rich and stable: https://github.com/nestdotland/deno_swc/actions

After tests it seems that wasm based deno-swc is slower than the ts module. Closing this issue for now until more options are available. Feel free to reopen again.

from bundler.

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.