Skip to content
This repository has been archived by the owner on Aug 13, 2023. It is now read-only.

Fix Babel/Storybook Setup #121

Merged
merged 8 commits into from Dec 6, 2018
Merged

Fix Babel/Storybook Setup #121

merged 8 commits into from Dec 6, 2018

Conversation

sareh
Copy link
Contributor

@sareh sareh commented Dec 5, 2018

Resolves #115

Storybook should work and all components should load in styles. Note: Reith font and normalise setup are not yet added. Those will be added in a separate PR.

Testing instructions

git checkout fix-babel-storybook-setup
npm install 

This installs initial dependencies & all individual packages

npm run storybook 

This runs clear_styled_components & then starts storybook

Visit http://localhost:8080

There should be no errors, and styles should be pulled in.

  • Tests added for new features
  • Test engineer approval

@sareh sareh added bug Something isn't working alpha-2 labels Dec 5, 2018
@sareh sareh added this to PR In Progress in Articles via automation Dec 5, 2018
@bcmn
Copy link
Contributor

bcmn commented Dec 6, 2018

So there's an interesting behaviour with this commit:
npm run storybook fails if .babelrc isn't present (with the exports read-only error)
npm run build fails if babel.config.js isn't present

It looks like Storybook simply doesn't support babel.config.js for the time being, so I guess we're stuck with working out how to make npm run build use the .babelrc file. Looking into this is my next move this morning.

@ChrisBAshton
Copy link
Contributor

Can we create a .babelrc in the .storybook dir which has this:

{ "extends": "../babel.config.js" }

...?

package.json Outdated Show resolved Hide resolved
@dr3 dr3 assigned sareh Dec 6, 2018
package.json Outdated
@@ -43,7 +43,6 @@
"@storybook/addon-options": "^3.4.11",
"@storybook/addon-viewport": "^3.4.11",
"@storybook/react": "4.0.0-alpha.8",
"babel-core": "^7.0.0-bridge.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Just tried locally and this doesn't appear to be needed - perhaps because we have that plugin-transform-modules-commonjs plugin for Jest now 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

Nope - wait - after running npm ci and then npm test, it fails "cannot find babel-core" so we do need it.

Copy link
Contributor

Choose a reason for hiding this comment

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

What is the reason for using the alpha of @storybook/react as opposed to something more recent - "^4.0.12"?

ChrisBAshton and others added 4 commits December 6, 2018 11:02
After much investigation, it looks as though the Storybook instance is overwritten by Storybook instances inside node_modules folders under the packages/components/** directory. This is our short-term solution; we intend to raise an issue with Storybook.
@sareh sareh moved this from PR In Progress to 1st Code review in Articles Dec 6, 2018
@ChrisBAshton ChrisBAshton moved this from 1st Code review to 2nd Code review in Articles Dec 6, 2018
Copy link
Contributor

@bcmn bcmn left a comment

Choose a reason for hiding this comment

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

Really good work hunting down all these issues, all!

mission_accomplie

@sareh sareh moved this from 2nd Code review to Test in Articles Dec 6, 2018
@sareh sareh merged commit 2b04161 into latest Dec 6, 2018
Articles automation moved this from Test to Done Dec 6, 2018
@sareh sareh deleted the fix-babel-storybook-setup branch December 6, 2018 14:00
@ChrisBAshton ChrisBAshton removed this from Done in Articles Jan 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working high priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Storybook on latest has an error
4 participants