-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
upgrading from 4.0.2 to 4.0.7 #2191
Comments
Any idea why these new dependencies got added between these minor versions? |
Only Can you additionally paste your entire |
Hi @jakeNiemiec, thanks for responding on this! After following the instructions here https://github.com/rails/webpacker#upgrading |
The problem is that your devDeps are invalid to begin with. Can you paste your entire package.json? |
If you don't want to make it public, you can tag me in an unlisted https://gist.github.com and I can comment there. |
@jakeNiemiec I think I just did that. Mentioned you in the comment section of a secret gist. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This is because your 4.0.2 package.json was invalid. See: https://github.com/rails/webpacker/blob/master/docs/yarn.md#add-an-npm-module-to-devdependencies Did moving them to "dependencies" work? |
It's just the new packages that I don't know why are added. |
I'll start this upgrade process again but first I'll move the packages that should be in devDependencies there. Then proceed with these instructions: https://github.com/rails/webpacker#upgrading. |
@jakeNiemiec I just run the commands for upgrade and packages.json ended up with a substantially smaller diff than earlier, I don't know what caused this behavior. I used the following to upgrade to 4.0.7:
after that my packages.json is:
We can close this issue because I can't reproduce the behavior I initially reported. |
@jakeNiemiec Okay, I think I realized what was happening back in July when I first tried to do this.
so I installed webpack-cli (altough with the -D options, I didn't about this https://github.com/rails/webpacker/blob/master/docs/yarn.md#add-an-npm-module-to-devdependencies). Now I installed it without -D (I'm always using -E though). After the dev server started up I was getting errors such:
after installing babel-loader as well and giving a shot to
and I could go on but eventually when I fix all these errors I'll end up with the extra dependencies that I listed in my initial message. Which returns me to my original questions, why my project works with an older webpacker version (4.0.2) with less dependencies and why it doesn't when I upgrade to a newer webpacker? |
Do you have a |
This comment has been minimized.
This comment has been minimized.
Please make the appropriate changes listed in the changelog: https://github.com/rails/webpacker/blob/master/CHANGELOG.md#407---2019-06-03 and |
Done. @babel/polyfill isn't used in my project so no changes there. Regarding the fixes for 4.0.7 I did the following:
When starting the dev server I'm receiving the same errors:
EDIT |
How are you adding |
Yes, except I add an exact version: |
Try this:
I see evidence that this may fix things for you. |
Unfortunately this makes no difference. After doing those steps running |
Inspired by your comment that might the -E that this problem I updated every dependency in my package.json to yarn asked me to specify which version of I picked the latest stable for both. Running Thank you for your suggestions! |
I just wanted to follow up on this thread. My application is upgrading from webpacker Prior to this upgrade, this is where our After the upgrade to This change in location required us to explicitly add I'm guessing this change might have something to do with yarn's resolution algorithm. Any thoughts on what explicitly might cause this change? |
Seems like this is what I'm referring to: #1537 |
Please make note of the breaking changes.
It should be accessible from both of those locations. This #2191 (comment) may help. |
I think that removing of the lock file and re-installing all the dependencies, incidentally moved the According to this yarn contributor,
See yarnpkg/yarn#5749 (comment) If I'm understanding this correctly, the optimal fix is to explicitly list |
@seanders You are entirely correct in your reasoning. I don't think that webpacker should be implicit about dependencies. Here is the list of those: Lines 14 to 53 in d393cc4
@swrobel Is correct in that issue. The only problem is that I personally come from the webpack/node.js side of things, I am simply not aware of a good way to fix this on the rails side of things. Do we just add all those dependencies onto |
Sounds like a rake take might be the right approach. Not sure of a better way to keep those dependencies ('@rails/webpacker', 'babel-loader', 'file-loader') in lockstep. |
Hmm. What about:
I am not sure a rake task is needed to update them in an existing package.json. If you update your webpacker to something that needs different versions than the originally-generated ones in your local Apologies if I'm missing the point or talking about something irrelevant; I come from ruby side, and am trying to figure out what the heck is going on. |
If it helps anyone at all, this is the
|
@jakeNiemiec this seems to be a recurring problem when trying to upgrade to the latest version. Yesterday I wanted to update form 4.0.7 to 4.2.2, following the instructions here https://github.com/rails/webpacker#upgrading. I experienced the same issue as I did during my previous upgrade. Ruby was complaining about This is not the way to go, because when you make a fresh install of webpacker you don't need any of those packages, right? So I figured that removing With the fresh yarn.lock I wasn't required to add all those modules to I think you should update the upgrade instructions and mention that as last step we should remove |
Removing yarn.lock might work as a workaround, but it's a problem if that's recommended/required, it should not be a required step to upgrade webpacker. Compare to removing your If it's necessary for you to remove |
@jrochkind you're right, this sounds more like a workaround than something that should be done as a step of the upgrade process.
I don't work with ruby at all so can't relate to this. Removing the
I agree. After running into this problem the second time, I'm pretty sure that this is one possible solution to these problems. |
@akoskm You should have those in your The best solution is to just add those dependencies yourself with |
@jakeNiemiec sorry, I missed that comment and didn't realize that this is and undocumented behavior. I work with other projects (babel/yarn/webpack, no webpacker) and you have to list |
This is a common misconception, even in other JS projects. Babel needs to be in your Lines 21 to 23 in ed6c121
Related issues #1880 (comment) Longer discussion on this topic: #1212 (comment) |
Sorry for the confusion, I was comparing webpacker to JS projects.
Yup, I understand this. With webpacker, babel must be listed under |
Upgrading from 4.0.2 to 4.0.7 introduces several
devDependencies
that weren't required in 4.0.2:I followed https://github.com/rails/webpacker#upgrading and https://github.com/rails/webpacker/blob/master/CHANGELOG.md to upgrade. I also copied the contents of https://github.com/rails/webpacker/blob/master/lib/install/config/babel.config.js over my local version of the same file.
I'm just curious if I'm doing something wrong that makes these new dependencies appear or this is ok.
Some of these dependencies like
@babel/plugin-transform-runtime
,@babel/plugin-proposal-class-properties
were used in babel.config.js at 4.0.2 as well but webpacker worked just fine without include these packages inpackage.json
.The text was updated successfully, but these errors were encountered: