Js-Brecht / gatsby-plugin-pnpm

Provides PNPM compatible module resolvers to Webpack for Gatsby
MIT License
48 stars 6 forks source link

ERROR #98123 WEBPACK Generating SSR bundle failed #1

Closed muuvmuuv closed 4 years ago

muuvmuuv commented 4 years ago

Getting this error:

ERROR #98123  WEBPACK

Generating SSR bundle failed

Can't resolve 'svg-react-loader' in '/Users/marvinheilemann/Development/Portfolio'

File: src/components/Logo.jsx

Following this PR here it succeeds. Maybe you can add resolveLoader as well.

Repository: https://github.com/muuvmuuv/portfolio

Js-Brecht commented 4 years ago

Thanks for reporting this! I can see how this could be needed. I'm not at all opposed to including Gatsby's pnpm node_modules in resolveLoader.modules as well. Was that all it took to solve the issue for you? Seems strange, since svg-react-loader looks like it is a dependency of gatsby-plugin-react-svg, and not Gatsby itself.

I'll know more once I can take a look at what is happening.

Js-Brecht commented 4 years ago

Hey @muuvmuuv, care to check out PR #2? Should be able to target Js-Brecht/gatsby-plugin-pnpm#release-v1.1.0 as a dependency, or just clone branch extended-options-resolveLoader.

EDIT: Sorry, I meant to target the release branch

Js-Brecht commented 4 years ago

This doesn't include your NODE_PATH environment variable in the resolution. I think Webpack already looks in your global node_modules, and I'm a firm believer in keeping your modules scoped to your project, to avoid any funky issues in the future.

If you feel like including the NODE_PATH environment variable in Webpack's resolutions is a must-have (e.g. you use that for some custom node resolutions, and want Webpack to use it, too), let me know; I can always add a new option that can be turned on to include your environment paths. That seems like it would be kind of an edge case, but I'm willing to add the feature if you, or somebody else, wants it.

muuvmuuv commented 4 years ago

This seems to work! Thank you :) I hope pnpm will get better integration into webpack soon.

Js-Brecht commented 4 years ago

v1.1.0 is published

This seems to work! Thank you :) I hope pnpm will get better integration into webpack soon.

I agree; webpack needs to rethink the way it resolves modules/loaders. I think the decision to go with their own module resolution strategy was decided way back before Node's module resolution was actually worth a damn 😆