Skip to content

Commit

Permalink
Merge 2bef0c6 into 881dbe8
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiot committed Jun 7, 2020
2 parents 881dbe8 + 2bef0c6 commit 1bee50f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/website/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
28 changes: 28 additions & 0 deletions packages/website/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* eslint-env node */
const {join} = require('path');
const isProd = process.env.NODE_ENV === 'production';

// This custom webpack config allows storybook to use the source files from 'react-vis'.
// Changes can be made and instantly be reflected in storybook to allow quick development
module.exports = {
webpackFinal: config => {
if (isProd) { return config;}

const reactVisPath = join(__dirname, '../../react-vis/src')

// Add an alias to 'react-vis' so that it looks in its src directory.
config.resolve.alias['react-vis'] =reactVisPath
config.resolve.modules.push(reactVisPath)

const jsRule = config.module.rules.find(rule => rule.test.test('test.js'));
// Add the react-vis/src folder to the list of files to compile
jsRule.include.push(reactVisPath)

const babelLoader = jsRule.use.find(x => x.loader === 'babel-loader');
if (babelLoader) {
babelLoader.options.rootMode = 'upward'
}

return config;
}
}
3 changes: 2 additions & 1 deletion packages/website/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ module.exports = {
},
resolve: {
alias: {
react: resolve(__dirname, './node_modules/react')
react: resolve(__dirname, './node_modules/react'),
'react-vis': resolve('../react-vis/src')
}
}
};

0 comments on commit 1bee50f

Please sign in to comment.