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

Remove the cacheDirectory option from babel config #1350

Merged
merged 3 commits into from
Jun 26, 2017

Conversation

tmeasday
Copy link
Member

@tmeasday tmeasday commented Jun 23, 2017

Issue: #1254

What I did

In storyshots, we are running babel directly, not through webpack, so we can't use this option, which applies to babel-loader. See https://github.com/storybooks/storybook/blob/master/app/react/src/server/config/babel.js#L15=

How to test

Trusty ol' test-cra, running npm test from inside examples/test-cra.

In storyshots, we are running babel directly, not through webpack, so we can't use this option, which applies to `babel-loader`. See https://github.com/storybooks/storybook/blob/master/app/react/src/server/config/babel.js#L15

#1254
const configDirPath = path.resolve(options.configPath || '.storybook');
configPath = path.join(configDirPath, 'config.js');

const babelConfig = loadBabelConfig(configDirPath);
// We set this in the default babel config, but it is webpack-only
delete babelConfig.cacheDirectory;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potentially we should remove this config from this file: https://github.com/storybooks/storybook/blob/master/app/react/src/server/config/babel.js#L15= and instead add it when adding the config to webpack.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds better!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, done! Please take a look at the last commit.

Along the way this actually improves the behaviour in RN, before it wasn't using a cache dir if you had a custom .babelrc (which I reckon you always would in RN)

@tmeasday
Copy link
Member Author

This issue would only surface if you ran jest in a directory that did not contain a .babelrc.

@codecov
Copy link

codecov bot commented Jun 23, 2017

Codecov Report

Merging #1350 into master will decrease coverage by 0.02%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1350      +/-   ##
==========================================
- Coverage   13.75%   13.73%   -0.03%     
==========================================
  Files         202      202              
  Lines        4623     4623              
  Branches      616      598      -18     
==========================================
- Hits          636      635       -1     
- Misses       3453     3473      +20     
+ Partials      534      515      -19
Impacted Files Coverage Δ
app/react-native/src/server/config/babel.js 0% <ø> (ø) ⬆️
app/react/src/server/config/babel.js 100% <ø> (ø) ⬆️
app/react/src/server/config.js 0% <0%> (ø) ⬆️
app/react-native/src/server/config.js 0% <0%> (ø) ⬆️
addons/storyshots/src/index.js 0% <0%> (ø) ⬆️
app/react/src/server/babel_config.js 44.82% <0%> (ø) ⬆️
app/react/src/client/preview/config_api.js 0% <0%> (ø) ⬆️
.../ui/src/modules/ui/components/left_panel/header.js 27.58% <0%> (ø) ⬆️
app/react-native/src/bin/storybook-start.js 0% <0%> (ø) ⬆️
addons/knobs/src/components/PropForm.js 8.51% <0%> (ø) ⬆️
... and 27 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 152630b...f0b4141. Read the comment docs.

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tmeasday @ndelangen I don't actually understand this completely, so I'm going to approve because it makes sense, but I'll let @ndelangen approve/merge.

@shilman
Copy link
Member

shilman commented Jun 26, 2017

@ndelangen merging this with @tmeasday 's updates, which have been tested for both react and RN. going to do a small release to get this and other patch fixes out.

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

Successfully merging this pull request may close these issues.

3 participants