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

Fix storyshots by moving cacheDirectory to webpack config #1713

Merged
merged 3 commits into from
Aug 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions app/react/src/server/config/babel.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
const findCacheDir = require('find-cache-dir');

module.exports = {
// Don't try to find .babelrc because we want to force this configuration.
babelrc: false,
cacheDirectory: findCacheDir({ name: 'react-storybook' }),
presets: [
[
require.resolve('babel-preset-env'),
Expand Down
9 changes: 8 additions & 1 deletion app/vue/src/server/config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable global-require, import/no-dynamic-require */
import fs from 'fs';
import path from 'path';
import findCacheDir from 'find-cache-dir';
import loadBabelConfig from './babel_config';

// avoid ESLint errors
Expand All @@ -13,7 +14,13 @@ export default function(configType, baseConfig, configDir) {
const config = baseConfig;

const babelConfig = loadBabelConfig(configDir);
config.module.rules[0].query = babelConfig;
config.module.rules[0].query = {
// This is a feature of `babel-loader` for webpack (not Babel itself).
// It enables a cache directory for faster-rebuilds
// `find-cache-dir` will create the cache directory under the node_modules directory.
cacheDirectory: findCacheDir({ name: 'react-storybook' }),
...babelConfig,
};

// Check whether a config.js file exists inside the storybook
// config directory and throw an error if it's not.
Expand Down
3 changes: 0 additions & 3 deletions app/vue/src/server/config/babel.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
const findCacheDir = require('find-cache-dir');

module.exports = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove unused findCacheDir above.

// Don't try to find .babelrc because we want to force this configuration.
babelrc: false,
cacheDirectory: findCacheDir({ name: 'react-storybook' }),
presets: [
[
require.resolve('babel-preset-env'),
Expand Down