question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Storysource Webpack rule causing build errors in Design Systems for Developers [REACT]

See original GitHub issue

Description

When I followed the instructions for adding webpack.config.js into .storybook, which pushes the loader rule for addon-storybook, it caused the build to error in every .stories file with the error Import in body of module; reorder to top import/first.

After researching the issue, I found that this comment seems to solve the problem: https://github.com/storybookjs/storybook/issues/6974#issuecomment-499903328

Proposed Change

Original:

//And update your webpack config in .storybook/webpack.config.js:

module.exports = function({ config }) {
 config.module.rules.push({
   test: /\.stories\.jsx?$/,
   loaders: [require.resolve('@storybook/addon-storysource/loader')],
   enforce: 'pre',
 });

 return config;
`};

Fixed:

//And update your webpack config in .storybook/webpack.config.js:

module.exports = function({ config }) {
 config.module.rules.unshift({
   test: /\.stories\.jsx?$/,
   loaders: [require.resolve('@storybook/addon-storysource/loader')],
   enforce: 'pre',
 });

 return config;
`};

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
domyencommented, Oct 4, 2019

thanks @jpmarra (just invited you to collaborate too)

1reaction
tmeasdaycommented, Oct 6, 2019

Seems to work! Thanks so much @jpmarra, this was something that had bugged me a bit.

Read more comments on GitHub >

github_iconTop Results From Across the Web

@storybook/react | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
Migrating a Create React App (Webpack) to NX and Vite
I'm currently being hit by a decodeURI malformed problem. I have no idea what it is causing it. C:\Users\asili\Documents\Programming\ ...
Read more >
Dependencies | umi_cps | npm - Open Source Insights
arrow_right antd. 3.26.16 Notes Relation Licenses Depende... Version 3.26.16 Published April 26, 2020 Description arrow_right father. 2.30.23 Notes Relation Licenses Depende... Version 2.30.23 Published September 15,...
Read more >
INTEGRATING MODERN FRONT-END METHODOLOGIES ...
Design System, Magento, Vue Storefront, PWA, Automated Web Testing ... allowing developers to create platform-agnostic solutions with a ...
Read more >
@massds/mayflower-react - npm package | Snyk
React versions of Mayflower design system UI components For more information about how to use this package see README. Latest version published 3...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found