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

Webpack 5 Support #350

Open
Programmerino opened this issue May 27, 2020 · 19 comments
Open

Webpack 5 Support #350

Programmerino opened this issue May 27, 2020 · 19 comments

Comments

@Programmerino
Copy link

As expected, scalajs-bundler will throw Unsupported webpack major version 5 when trying to use any webpack version with a major version higher than 4.

The update seems to primarily focus on better caching for better performance, deterministic builds, smaller output sizes, and better WebAssembly support.

I'm unsure about what needs to be changed here, but I assume that the changes to compiler hooks could be important.

I don't really expect support to be added until after it comes out of beta and enough plugins get up to date, but progress can be tracked here.

Migration Guide: https://webpack.js.org/migrate/5/

@cquiroz
Copy link
Collaborator

cquiroz commented May 27, 2020

I have the intention to add version 5 support (Maybe we should delete support for versions 3 and older) but sure, we need to wait for a public release first.

@cquiroz
Copy link
Collaborator

cquiroz commented Aug 14, 2020

I'm taking a look at this, the format of the stats has changed, it may take a while to get right and it maybe hard to support both webpack 4 and webpack 5

@cquiroz
Copy link
Collaborator

cquiroz commented Oct 13, 2020

Webpack 5 was released, we should try to get this moving.
Having backward compatibility is getting to be a drag, Should we consider removing support for some of the older versions?

@julienrf
Copy link
Contributor

Should we consider removing support for some of the older versions?

This is fine by me, but I would like to hear from other users of scalajs-bundler :)

@easel
Copy link
Contributor

easel commented Oct 13, 2020

So long as 5 works, I'm happy to drop 4. I do have some customizations, but they are hopefully simple enough they won't be hard to port.

@dispalt
Copy link
Contributor

dispalt commented Oct 15, 2020

yeah I say we track the latest with master, and drop support for others but keep a branch around in case. It's not like people are needing fixes that often with this since it's mainly glue code. The only exception seems to be that sjsbundler will need some changes for scala 1.3.0 to work.

@vhiairrassary
Copy link
Contributor

vhiairrassary commented Jan 9, 2021

Following this ticket I created #390 (pretty such a PoC, still a draft). I would love to get feedbacks from you before finishing the remaining tasks.

@vhiairrassary
Copy link
Contributor

#390 has been merged. @cquiroz could you publish a RC please, so users can test & we can address issues?

@povder
Copy link

povder commented May 15, 2021

Thanks @vhiairrassary for your work on #390. Do you plan to release an RC with webpack 5 support @julienrf @sjrd @cquiroz ? I'm willing to test it out.

@arashi01
Copy link

@julienrf @sjrd @cquiroz Also happy to do any testing, or anything else needed to help get this released. Getting to the point where a number of Webpack plugins are no longer supporting V4 in their most recent iterations.

@evbo
Copy link

evbo commented Jun 3, 2021

would love to test out the latest RC which contains webpack 5 support. Any instructions on how to manually build scalajs-bundler?

@vhiairrassary
Copy link
Contributor

@evbo You can clone the repository, run sbt publishLocal and use the produced artefact in the plugins.sbt file from your project

@Jaystified
Copy link

I've given the v0.21.0-RC1 tag a go in our project.

I've had to change webpack's config by adding {test: /\.m?js/,resolve: {fullySpecified: false}} to module.rules and changing the way webpack-merge is imported to const { merge } = require('webpack-merge'); , the upgrade was painless and the RC seems to work fine!

@bblfish
Copy link

bblfish commented Nov 20, 2021

Would it be worth updating the documentation? For the moment it only mentions web pack 4 support.
I am trying to get going...

@evbo
Copy link

evbo commented Nov 23, 2021

so far for me fast optimization is working, but as @Jaystified mentioned there's some painless webpack config updates anyone using webpack needs to consider.

However, one unusual issue is after fast optimization, the dev server appears to start but with some errors:

[webpack-cli] Unable to load '@webpack-cli/serve' command
[webpack-cli] TypeError: options.forEach is not a function

I'm also noticing version in webpack appears deprecated... Some other way to set that?

UPDATE for the latest SBT version here's what I use (@bblfish):

webpack / version := "5.64.2"
// this fixes above error I was getting, per github issue in webpack repo
webpackCliVersion := "4.9.1"
startWebpackDevServer / version := "4.5.0"

@unarist
Copy link
Contributor

unarist commented Nov 24, 2021

We've also encountered issues which will be fixed in #408:

[error] Error parsing webpack stats output
[error] /warnings(0)/moduleName: JsonValidationError(List(error.path.missing),WrappedArray())
[error] /warnings(1)/moduleName: JsonValidationError(List(error.path.missing),WrappedArray())
[error] /warnings(2)/moduleName: JsonValidationError(List(error.path.missing),WrappedArray())
[error] Error parsing webpack stats output
[error] /warnings(0)/moduleName: JsonValidationError(List(error.path.missing),WrappedArray())
[error] /warnings(1)/moduleName: JsonValidationError(List(error.path.missing),WrappedArray())
[error] /warnings(2)/moduleName: JsonValidationError(List(error.path.missing),WrappedArray())
[error] java.lang.AssertionError: assertion failed: Webpack failed to create application bundle

Since our warnings are due to the Performance Hints, we decided to use performance: { hints: false } as a workaround for now.

@silizza
Copy link

silizza commented Jul 28, 2023

Hello.
Any updates here?

@matthughes
Copy link

I think the community is moving off this plugin and towards using Vite: https://www.scala-js.org/doc/tutorial/scalajs-vite.html.

@ioleo
Copy link
Contributor

ioleo commented Aug 14, 2023

Worked for me, using scalajs-bundler 0.21.1:

// webpack config
webpack / version               := "5.88.2",
webpackCliVersion               := "5.1.4",
startWebpackDevServer / version := "4.15.1",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests