You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
'core' build process uses the replace method which causes things to fail if the storybook repo is in a path with 'src' above it on the local hard drive.
Reproduction link
Can't using storybook.new because its a pathing issue
Reproduction steps
Clone storybook repo in ~/src/storybook
Run yarn start
You will receive a build error and some files will be built to ~/dist/
This appears to be because of the use of .replace('src', 'dist') throughout some of the core prepare scripts against entry files. .replace will replace the first occurrence of 'src' with 'dist'.
To fix .replace should be replaced with a utility function the replaces last occurrence of 'src' with 'dist'
System
N/A
Additional context
No response
The text was updated successfully, but these errors were encountered:
** Disclaimer** This information might be inaccurate, due to it being generated automatically
This is caused by naive string replacement in the build scripts. The fix requires updating the path handling in the build process to only replace the last occurrence of 'src' with 'dist'. Key changes needed: 1. Replace instances of .replace('src', 'dist') with a function that replaces only the last occurrence: js const replaceLastSrc = (path) => { const lastIndex = path.lastIndexOf('src'); if (lastIndex === -1) return path; return path.substring(0, lastIndex) + 'dist' + path.substring(lastIndex + 3); }; 2. Main locations to update: - scripts/prepare.js - Any build scripts in code/lib/core-* packages that handle path transformations This will prevent the build process from incorrectly transforming parent directory paths that contain 'src'.
About Greptile
This response provides a starting point for your research, not a precise solution.
Help us improve! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
Describe the bug
'core' build process uses the replace method which causes things to fail if the storybook repo is in a path with 'src' above it on the local hard drive.
Reproduction link
Can't using storybook.new because its a pathing issue
Reproduction steps
You will receive a build error and some files will be built to ~/dist/
This appears to be because of the use of .replace('src', 'dist') throughout some of the core prepare scripts against entry files.
.replace
will replace the first occurrence of 'src' with 'dist'.To fix .replace should be replaced with a utility function the replaces last occurrence of 'src' with 'dist'
System
Additional context
No response
The text was updated successfully, but these errors were encountered: