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

Bundlers support for Scala.js #297

Open
romanowski opened this issue Oct 25, 2021 · 3 comments
Open

Bundlers support for Scala.js #297

romanowski opened this issue Oct 25, 2021 · 3 comments
Labels
Community help wanted Issues that idicate features that are nice-to-have but core team does not have time to work on it Scala.js

Comments

@romanowski
Copy link
Member

romanowski commented Oct 25, 2021

from @alexarchambault

It'd be nice to offer some kind of support for bundling Scala.JS projects with snowpack.

In particular, it'd be nice to have the scenario described in this post to work fine with Scala CLI.

Generally, it'd be nice to offer features similar to scalajs-bundler, offering to:

  • add NPM dependencies
  • tests in jsdom?
  • bundle Scala.JS via webpack

We are not really sure what the overall UX / options should be

@romanowski romanowski added Scala.js Community help wanted Issues that idicate features that are nice-to-have but core team does not have time to work on it labels Oct 25, 2021
@romanowski romanowski changed the title Snowpack bundler support Bundlers support for Scala.js Oct 25, 2021
@armanbilge
Copy link
Contributor

Snowpack is now dead and Vite is favored over Webpack for Scala.js tutorials. Other contenders include esbuild and Turbopack (branded as a Webpack successor).

But, I'd like to point out an alternative to keeping-up-with-the-JavaScript-bundlers:

With ES Modules, which are now natively supported in all browsers, browsers can load a dependency directly from a CDN so it doesn't need to be bundled in the application JS.

The trick is that you probably don't want to hardcode a CDN URL in your @JSImports in some library. So we need some sort of link-time "import map", which enables the user to remap these standard import statements (referring to the NPM packages) to import statements that point to their preferred CDN instead.

Further reading:

@Gedochao
Copy link
Contributor

This hasn't been selected for the current roadmap.
If you'd like Scala CLI team to work on this, feel free to upvote/thumbs-up this issue.
If anyone is interested in working on this themselves, feel free to reach out to us here or on discord.

@armanbilge
Copy link
Contributor

To be clear: I don't want to encourage anyone to work on this issue. As I mentioned, JS bundlers come and go like the wind. Instead, I encourage to focus on using technologies that are natively supported by browsers and other runtimes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community help wanted Issues that idicate features that are nice-to-have but core team does not have time to work on it Scala.js
Projects
None yet
Development

No branches or pull requests

3 participants