Closed marozzocom closed 3 years ago
All this plugin does is tell Webpack where to look for modules and loaders. The cacheGroup
is configured in Gatsby core
So the problem is here... the issue is that with pnpm, there's ALWAYS two levels of node_modules
.
Sorry, I think I got a little bit ahead of myself. It does make sense to add this configuration fix to this plugin instead of to the core. I can add that soon
@marozzocom care to try gatsby-plugin-pnpm@next
?
The fix I used here can actually be implemented in the core, which is a better idea. That way there's only one source of truth for the framework bundles. So I've opened https://github.com/gatsbyjs/gatsby/pull/32701
I can publish this for now though, assuming it works for you. My tests were successful
After a very brief test, everything seems to be working, and the error is gone. 👍🏻 Thank you for the quick work, likewise for creating the PR in Gatsby -- I'll be following both to see where the change eventually goes!
Published in gatsby-plugin-pnpm@1.2.7
Description
When running
gatsby develop
framework code (e.g. React source) seems to be bundled incommons.js
instead offramework.js
, but Gatsby still attempts to load the file within a<script>
element. The missing file leads to the 404 page thus causing an error in the console.To Reproduce
pnpm install
npm run start
Expected: No errors.
Observed: Error in console:
Uncaught SyntaxError: Unexpected token '<'
Additional information
Observed using
This does not affect how the site works and does not seem to affect production builds at all, but it is annoying and led me to spend quite a bit of time investigating what was wrong in my configuration. It would be good if there was a way to fix the behavior, suppress the error or at least add a note to documentation.
I don't have enough knowledge to suggest this would be a "correct" fix, but changing the
framework
cacheGroup regexp seems to correct the issue, namely removing(?<!node_modules.*)
.