storybook: Storybook does not respect cacheDirectory for cache location
Describe the bug
Storybook creates .cache folder in the root of my project despite my webpack config specifies a different location for cacheDirectory
To Reproduce Steps to reproduce the behavior:
- Run storybook
Expected behavior
Cache folder is created in the location specified by cacheDirectory
Code snippets
Webpack config:
...
module: {
rules: [
{
test: /\.js?$/u,
exclude: /node_modules/u,
use: {
loader: 'babel-loader',
options: {
cacheDirectory: path.join(process.cwd(), 'build/cache/babel')
}
}
}
]
}
...
System:
- OS: macOS
- Device: N/A
- Browser: N/A
- Framework: react
- Version: 4.0.0
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 10
- Comments: 15 (7 by maintainers)
Commits related to this issue
- Fixes #4665: set correct cache directory path — committed to alex-fournier/storybook by alex-fournier 6 years ago
- Merge pull request #4792 from alex-fournier/fix-cache-directory Fixes #4665: set correct cache directory path — committed to storybookjs/storybook by ndelangen 6 years ago
- Merge pull request #4792 from alex-fournier/fix-cache-directory Fixes #4665: set correct cache directory path — committed to storybookjs/storybook by ndelangen 6 years ago
I have Babel caching enabled but rely on the default path of
node_modules/.cache/babel-loader. I noticed there’s also a cache file for Storybook innode_modules/.cache/react-storybook. Why is an additional cache folder needed at the root level? Could the two folders be combined? I too prefer to have my all my cache folders in the same location which is whynode_modulesworks perfect for me.Thanks @alex-fournier !
https://github.com/babel/babel/issues/5198#issuecomment-277603878
https://babeljs.io/docs/en/babel-register#babel_cache_path=
It would be good if sb supports customizing the cache path
Yeah,
node_modules/.cacheseems standard and is conveniently beneath the deps folder which is already ignored.Same thing in my case. I already ignore
buildfolder where my build output is stored together with babel cache and some other cache files.For me I don’t want to add a new line to .gitignore for every module that needs a cache folder. So if there’s an easy way to define this globally, or in config, I’d prefer to supply a path that is already ignored.