Skip to content
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

[Bug]: incorrectly build preview when use pnpm with custom virtual store directory #20211

Open
DudaGod opened this issue Dec 12, 2022 · 1 comment

Comments

@DudaGod
Copy link

DudaGod commented Dec 12, 2022

Describe the bug

When use latest version of pnpm with .npmrc like this:

store-dir=${HOME}/.some-folder/pnpm-store
virtual-store-dir=${HOME}/.some-folder/pnpm-virtual-store

About store-dir and virtual-store-dir.

So in case when my node modules located somewhere outside the project then used babel-loader for preview - https://github.com/storybookjs/storybook/blob/7a86f0363ef184a80437b7abf98e98d86e821f75/code/lib/builder-webpack5/src/preview/babel-loader-preview.ts defines include property incorrectly. As a result babel-loader not transpile my storybook components and I got some TS error.

The problem in this getProjectRoot method -

export const getProjectRoot = () => {
let result;
try {
const found = findUp.sync('.git', { type: 'directory' });
if (found) {
result = result || path.join(found, '..');
}
} catch (e) {
//
}
try {
const found = findUp.sync('.svn', { type: 'directory' });
if (found) {
result = result || path.join(found, '..');
}
} catch (e) {
//
}
try {
result = result || __dirname.split('node_modules')[0];
} catch (e) {
//
}
return result || process.cwd();
};
. It founds node_modules inside my virtual store in home and thinks that my components located in one directory up.

To fix this problem, I need to change include option for babel-loader inside webpackFinal.

Another bug with this method - #14042

To Reproduce

No response

System

No response

Additional context

No response

@chakAs3
Copy link
Contributor

chakAs3 commented Jan 14, 2023

i'm getting issue with testing everytime i use pnpm even in other projects , so I have to clean the cache I remove all node_modules and build again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants