Webpacker: Simply depending on @rails/webpacker isn't enough? Possibly need to add all dependencies to package.json

Created on 30 May 2018  路  3Comments  路  Source: rails/webpacker

I've had a very confusing conversation with the yarn team on this issue which has led them to indicate that all dependencies that are directly used by a project need to be in package.json, they can't simply be implied by being dependencies of another package in package.json. This particular issue caused babel-loader to not be available to my app after using yarn upgrade.

Most helpful comment

Not sure why this was closed @jakeNiemiec. Yarn is moving towards the PnP system that explicitly prevents accessing dependencies of another package, see https://yarnpkg.com/en/docs/pnp/troubleshooting

All 3 comments

I've ran into the same thing and did a quick check with npm (5.7.1, not the current one) instead of yarn and there everything worked. But once I use yarn (1.7.0) and upgrade webpacker from 3.2.2 to 3.4.1 (while following the steps described in the README to upgrade), compilation will always fail with ERROR in Entry module not found: Error: Can't resolve 'babel-loader'. Going back to webpacker 3.2.2 everything still works, even with Yarn.

As I'm a bit short on time right now, I didn't investigate further and simply pinned everything to 3.2.2, but something seems to have changed between those versions that Yarn doesn't like. But that's just a hunch :)

Not sure why this was closed @jakeNiemiec. Yarn is moving towards the PnP system that explicitly prevents accessing dependencies of another package, see https://yarnpkg.com/en/docs/pnp/troubleshooting

Yarn is moving towards the PnP system that explicitly prevents accessing dependencies of another package

@swrobel See the Yarn Plug鈥檔鈥橮lay ticket. We can focus there on eliminating the reliance on cross package boundaries in this file:

https://github.com/rails/webpacker/blob/848161489864b247ade97ddb4da9302a79eda3c0/lib/install/template.rb#L37-L46

Additionally, webpacker was a very different tool back when this was posted. There have been updates to both the webpacker and node.js sides of the problem. If you want to keep this open, could you post updated info about what packages are still missing in package.json?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bbugh picture bbugh  路  3Comments

FrankFang picture FrankFang  路  3Comments

ijdickinson picture ijdickinson  路  3Comments

ankitrg picture ankitrg  路  3Comments

iChip picture iChip  路  3Comments