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 4.0 #1316

Merged
merged 1 commit into from
Apr 2, 2018
Merged

Webpack 4.0 #1316

merged 1 commit into from
Apr 2, 2018

Conversation

gauravtiwari
Copy link
Member

@gauravtiwari gauravtiwari commented Mar 3, 2018

This PR adds webpack 4.0 support to Webpacker.

TODO:

  • Use new webpack 4 development and production modes
  • Upgrade webpack dev server
  • Pre-release of WebpackManifestPLugin compatible plugin
  • Mini css extract plugin
  • Vue loader
  • Use new built-in options
  • Update readme
  • Test examples

Blockers

@renchap
Copy link
Contributor

renchap commented Mar 10, 2018

It might be a good idea to replace extract-text-plugin with https://github.com/webpack-contrib/mini-css-extract-plugin once HMR support is merged.

@gauravtiwari
Copy link
Member Author

Thanks @renchap that's the plan 👍

@montogeek
Copy link

What is the status of this PR? Is there something we can help from webpack side?

@rossta
Copy link
Member

rossta commented Mar 22, 2018

@montogeek Note the blocker in the description. This project relies on plugin that hasn't merged v4 support yet.

@montogeek
Copy link

@rossta Already commented on it

@@ -11,7 +10,7 @@ module.exports = class extends Base {

this.plugins.append(
'UglifyJs',
new UglifyJsPlugin({
new webpack.optimize.UglifyJsPlugin({

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work with ES6 modules

@gauravtiwari gauravtiwari force-pushed the webpack-4.0 branch 3 times, most recently from 1b9c77f to 9b9b309 Compare April 2, 2018 17:58
@gauravtiwari
Copy link
Member Author

This PR is going to take a while since the plugin and loader support isn't 100% yet - the main blockers are manifest and vue loader, everything else seems to be working fine.

Will release a beta once this PR is merged and then we can incrementally enhance in separate PRs until stable 4.0.x

@gauravtiwari gauravtiwari changed the title Webpack 4.0 [WIP] Webpack 4.0 Apr 2, 2018
@gauravtiwari gauravtiwari merged commit a2aa739 into master Apr 2, 2018
@gauravtiwari gauravtiwari deleted the webpack-4.0 branch April 2, 2018 21:57
gauravtiwari added a commit that referenced this pull request Apr 2, 2018
@gauravtiwari
Copy link
Member Author

Just published a pre-version:

To try out:

gem 'webpacker', '>= 4.0.x'
yarn add @rails/webpacker

@apuntovanini
Copy link

@gauravtiwari any hints on how to get it working / upgrading?
Thanks!

@gauravtiwari
Copy link
Member Author

@apuntovanini Pretty simple and no breaking changes (AFAIK) - just update gem and npm package as above ^^

@saneef
Copy link

saneef commented Apr 3, 2018

@apuntovanini You might have to run bundle exec rails webpacker:install if you are upgrading on the existing project.

@apuntovanini
Copy link

:) yep, thats the reason I asked, mine is broken, saying no manifest found. I use CommonsChunkManifest (now deprecated, isn't it?), but even without it doesnt work

@apuntovanini
Copy link

ah, I see, didn't try that, I will try again and let you know ASAP, thanks!

@gauravtiwari
Copy link
Member Author

@apuntovanini Oh yes, that's true. Please see this gist on how to migrate common chunk - https://gist.github.com/sokra/1522d586b8e5c0f5072d7565c2bee693#configurate-cache-groups

@gauravtiwari
Copy link
Member Author

gauravtiwari commented Apr 3, 2018

With webpacker it would be,

environment.config.merge({
  optimization: {
    splitChunks: {
      cacheGroups: {
        commons: {
          test: /[\\/]node_modules[\\/]/,
          name: 'vendors',
          chunks: 'all'
        }
      }
    }
  }
})

@apuntovanini
Copy link

Wonderful, it does work (bundle exec rails webpacker:install was indeed needed)! Now running webpack 4 with no issues! Thanks a lot!

@JWesorick
Copy link

when is the non pre release version coming?

@vcavallo
Copy link

I see webpack: ^3.11.0 in my yarn.lock - is that correct? I was

@danielpowell4
Copy link

@gauravtiwari Any timeline for moving 4.x to stable?

If there is a clear checklist/roadmap I'm sure there are a good few of us who will help out!

@gauravtiwari
Copy link
Member Author

@danielpowell4 Thanks, basically it's nearly there. I have made this PR (#1546) a while ago but couldn't finish it, apologies :(

Will try to get this done over the weekend and see if I can publish a stable release next week.

@danielpowell4
Copy link

@gauravtiwari no need to apologize! Timeline sounds awesome.

I have been on the pre version since it came out. Only recently ran into a snag when I went to tweak my babel config.

If you need help writing docs or monitoring the repo, feel free to reach out!

@iChip
Copy link

iChip commented Sep 11, 2018

What's involved in getting 4.x released? Happy to assist.

@danielpowell4
Copy link

@gauravtiwari Any updates?

I'm sure some like @iChip are willing to lend a hand if possible!

@gauravtiwari
Copy link
Member Author

Hey, Sorry, I need to find sometime to review some PRs like: #1694 and go through this big list of issues: https://github.com/rails/webpacker/issues to see if we have missed anything obvious that should be in 4.x stable release.

What if I release a beta 4.x version? Would that help time being?

@gauravtiwari
Copy link
Member Author

Just made another pre-release:

yarn add @rails/webpacker@next
bundle update webpacker

@gauravtiwari
Copy link
Member Author

Also, now Rails 6.0-alpha ships with Webpacker as default- https://github.com/rails/rails

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

Successfully merging this pull request may close these issues.

10 participants