vercel / next.js

The React Framework
https://nextjs.org
MIT License
124.84k stars 26.65k forks source link

Migrate to Webpack 4 #3923

Closed rgbkrk closed 6 years ago

rgbkrk commented 6 years ago

Context

We ❤️next.js! I made the (possibly) poor decision of migrating our (nteract's) monorepo to Webpack 4 only to notice that next.js is on webpack 3. How far off is a migration to webpack 4? My primary reason for asking is to know if I should switch us back to webpack 3 or just wait on the next next version. 😄

We have a few non-next.js apps (some loaded by a python server, one by electron) and we want to make the webpack similar using the universal webpack configurator plugins crafted for next 4. I don't want to break our next apps, so I kept those a bit separate.

timneutkens commented 6 years ago

I have something in the works. No ETA though.

rgbkrk commented 6 years ago

Looks like webpack-dev-middleware just upgraded, which should help a lil' bit.

https://github.com/webpack/webpack-dev-middleware/pull/267

krazyjakee commented 6 years ago

If I'm going to start a new project, will it be hard to migrate from the current version of nextjs to a version using webpack 4?

timneutkens commented 6 years ago

As long as you run the latest version of Next.js we're not going to break much.

vzaidman commented 6 years ago

any progress on this? can i help? i recently migrated a big project to webpack 4.

simonjoom commented 6 years ago

I just in progress to reload the project with web pack 4 I use it already , work good with last dev-middleware/hot middleware and some code adjustment, Personnaly i removed the feature ondemand in this.. i adjusted hot-reload with the last Soon will provide the link

simonjoom commented 6 years ago

Here my work for webpack4 (i just did tested on browser only )

A little boilerplate using no babelified code of source nextJs inside with feature like hot-reload completely working with css,css and js

I changed a bit the core of nextjs to make all works .. i wait for any questions

https://github.com/simonjoom/NextJs4Reloaded

Please read https://github.com/simonjoom/NextJs4Reloaded#feature-tested

4332

timneutkens commented 6 years ago

From my comment here: https://github.com/zeit/next.js/issues/4332#issuecomment-388333203

As said on twitter I wouldn't recommend using this since it removes a lot of features / is not tested. But we can sure copy a few things.

Either way there's no need for an extra issue.

Duplicate of #3923

Thanks for sharing 🙏

SindreSvendby commented 6 years ago

Hi

I see that there is not much activity i the add/webpack4 branch.

Since the release of webpack 4 , next.js v6 has been released without support for webpack 4, I assumes that is because it's a bit tricky or more work then expected to get webpack 4 to work with next.js?

Is there anything we as a community can do to help with this?

Are you able to outlines the steps that you guys want to take to get webpack 4 into next.js? If we are able to break this into smallere pieces I'm sure more people will join in and help us get this done!

:heart: Great work on next! use it in so many apps! :heart:

timneutkens commented 6 years ago

If we are able to break this into smallere pieces I'm sure more people will join in

The problem with Webpack 4 right now is that it requires a big refactor of certain parts of how Next works right now. I'll get onto that after #4496. As you can see in the "WIP" branch it's far from a simple yarn add webpack@4.

rgbkrk commented 6 years ago

You all rock!

jesstelford commented 6 years ago

It looks like Webpack 4 is included in 6.1.1-canary.3 :tada: