-
Notifications
You must be signed in to change notification settings - Fork 27.7k
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
Not working with pnpm #2855
Comments
Here is the tree:
|
Seems that if I |
Hi, I could further detail your problem. |
I've tried |
But may be we could find some workaround. If there's something specific we need to do in the core, feel free to send a PR. |
Related #2846 |
npm linked
pnpm node_modules
Both modules its saying its missing are there, and the Maybe the files are failing to compile...the trouble is there is not error messages, and it doesn't happen when npm linked so I have to work with the transpiled babel code directly from node_modules (no sources are packaged) :S _error.js
So the error messages are silenced by default...this is really bad...I will file a bug against this. Had to add to
Now I see the errors!
Now my issue is
Something to note is that there is no error when removing the
So the babel presets must be the cause I would guess. But then a bunch of other errors popup all over the place. There seems to be three places that the |
@arunoda Could you provide any assistance with resolving this, or perhaps point us in the right direction? I feel like there will be a single line change somewhere that will resolve this, but I cannot find it. I'm guessing its something to do with Basically the paths will be:
instead of
If I run
|
Okay so looks like it is Using npm I see:
With pnpm I see:
|
So I think I was handicapping myself when playing around with the settings.
https://github.com/babel/babel-loader#options This cannot be overridden by passing in
I could not see any temp dirs and I disabled the setting so I didn't think there was a cache, but it was hiding in |
Fix
const dirResolve = require('dir-resolve')
module.exports = {
webpack: (config, {dev}) => {
useCustomPresetForPagesBabelLoader(config)
}
}
function useCustomPresetForPagesBabelLoader(config) {
// node_modules/next/dist/pages
const nextDistPagesBabelLoader = config.module.rules.find(
({loader, include}) =>
loader === 'babel-loader' && include === dirResolve('next/dist/pages'),
)
nextDistPagesBabelLoader.options.presets = [require.resolve('./babel-preset-next-pnpm')]
}
Make a duplicate of E.g. [require.resolve('babel-plugin-module-resolver'),
{
alias: {
...
'next/link': 'next/dist/lib/link'
...
}
] Not sure if this will break things for production deploys, I haven't checked. I will look to publish this preset later. |
Can you publish the babel-preset to npmjs please? It would really help. |
Also a simple documentation for this fix? It is really critical for my project. |
This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread. |
pnpm is an alternative package manager.
Expected Behavior
Should work.
Current Behavior
Steps to Reproduce (for bugs)
Context
Your Environment
The text was updated successfully, but these errors were encountered: