-
Notifications
You must be signed in to change notification settings - Fork 81
Conversation
example/package.json
Outdated
"stats-webpack-plugin": "^0.2.1", | ||
"webpack": "^1.9.11", | ||
"webpack-dev-server": "^1.9.0" | ||
"stats-webpack-plugin": "*", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no release of this plugin that supports 2.2.0-rc.0 explicitly. It currently requires 2.2.0-beta. I honestly don't know what this even does, but nothing broke locally for me.
I'm guessing the steady-state of this might look like:
{
"stats-webpack-plugin": "^0.x.y", // whatever version is compatible
"webpack": "^2.2",
"webpack-dev-server": "^2.2"
}
(Note that I'm not super-familiar with node best practices for versioning—I'm trying to express "2.2 and above but not 3.0")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stats-webpack-plugin is used by the dev server to produce the live manifest for the helper
@@ -54,8 +57,7 @@ if (production) { | |||
new webpack.DefinePlugin({ | |||
'process.env': { NODE_ENV: JSON.stringify('production') } | |||
}), | |||
new webpack.optimize.DedupePlugin(), | |||
new webpack.optimize.OccurenceOrderPlugin() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This plugin is included by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the configuration for UglifyJsPlugin
is also not necessary any more since the options passed above for warnings and sourcemaps are the default in webpack 2, see migration guide. I have tested making lines 50-53 just new webpack.optimize.UglifyJsPlugin(),
in my rails app and it seems to be working as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, I've removed the superfluous config
Right now I'm thinking that there will be a "If you'd like to use webpack 2, use gem version x or below" notice. |
OK, I've squashed and repushed now that webpack 2 is officially released. I have tested this locally and it works the same as before, but uses webpack 2. woot! Would love a review and release. My book that uses this is in copyediting so I'd love to be able to change it to use a released version of this plugin. |
"stats-webpack-plugin": "^0.4.3", | ||
"webpack": "^1.14.0", | ||
"webpack-dev-server": "^1.16.2" | ||
"stats-webpack-plugin": "*", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not loving this, but since we're now using yarn, not as worried about open-ended deps
Anything I can do to get this released? |
@davetron5000 We've got webpack 2 working internally with this gem at marketplacer - I need to set up a test environment to confirm that this change works on its own and also make a decision regarding Webpack 1 support. |
Cool. I hd it working with the sample app in my book as well. I'd like to be able to just tell readers "use webpack-rails" and not "use this branch/sha-1 of webpack-rails". But I know my book release timeline isn't your top priority :) If you want my thoughts on webpack 1 (even though didn't ask :), it's: don't support it directly. Reasons:
|
Excuse me for intervention, I wanted to comment on Rails 5.1 webpack solution. It'll be based on webpacker. This gem says in readme:
Which means they aren't going to explicitly support |
@troglotit, @davetron5000 @mipearson The former assumption Webpacker not supporting non JS assets is changing. I'm getting involved in the Webpacker project, and I intend to have React on Rails support it. Please see my thoughts on this topic: rails/webpacker#139. I look forward to any comments on this topic and if anybody wants an invite to our Slack room for ShakaCode, please email me at [email protected]. |
I had assumed webpack's existence in a rails project could allow it to do whatever, and that webpacker would simply optimize an initial configuration for "app-like javascript". In other words, Rails 5.1 should not really need this gem I don't think. |
Just want to drop a note here for people looking at this and wondering when the gem will support webpack 2: it supports it today, we're using it in production, it's just that the default configuration generated is for webpack 1. |
Hi, I had to create a fork with my changes on it so I could send my book to copyediting. I needed the book to support webpack 2 and did not want to require the user to use this gem, erase the configuration it generated for them, and create it from scratch. I now this is fairly annoying—I'll try to keep things in sync. Don't write a book about JavaScript :) |
Hey, I've started using this patch in my project, and everything seems to work. But take it with grain of salt: my project is not in production yet and I haven't used webpack before, although I really did dig into it, also One line which I changed is I removed DedupePlugin as it said in https://webpack.js.org/guides/migrating/#dedupeplugin-has-been-removed |
I'm using Webpacker now, so don't need this merged. Gonna close it as it's getting pretty old, but feel free to use this if you like for a future PR |
These are (obviously) breaking, but fairly minimal.
I applied these changes to my own app based on the migrating guide and what this gem puts into the initial config is fairly minimal, so the changes are not that great.
I think the best thing to do right now with this PR is to have others try it. It's obviously not releasable in its current state because of the RC dependency.
Another question is: when Webpack 2 is released, should this gem support both versions? If so, I'm guessing we'll need to have a bit more code to allow the user to choose which version.
Fixes #73