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.

preset-create-react-app all files need to be in a src/

See original GitHub issue

You are forced to include all files in a /src file

What the hell happened here?

    (plugin: { appSrcs: string[] }) => {
      if (plugin.appSrcs) {
        // Mutate the plugin directly as opposed to recreating it.
        // eslint-disable-next-line no-param-reassign
        plugin.appSrcs = [...plugin.appSrcs, resolve(options.configDir)];
      }
      return plugin;
    },
  );

That’s clearly a breaking change and as it looks has nothing to do with the bug which the commit links to.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:35 (11 by maintainers)

github_iconTop GitHub Comments

16reactions
bardcommented, Aug 24, 2020

The following worked for me. It removes the plugin that enforces the “under src/” rule.

module.exports = {
  stories: ['../src/components/*.stories.*'],
  addons: [
    '@storybook/preset-create-react-app',
    '@storybook/addon-essentials',
  ],
  webpackFinal: (webpackConfig) => {
      const scopePluginIndex = webpackConfig.resolve.plugins.findIndex(
        ({ constructor }) =>
          constructor && constructor.name === 'ModuleScopePlugin',
      )

      webpackConfig.resolve.plugins.splice(scopePluginIndex, 1)
      return webpackConfig
    }
}
4reactions
ldevebercommented, Apr 8, 2020

I am also seeing this issue. I made an app today with create-react-app, and added storybook. I like to keep things separate, so I changed the directories to be as follows:

- project/
  - src/
  - stories/
  - test/

And changed the appropriate line in ./storybook/main.js to stories: ['../stories/**/*.stories.js'],. This broke everything! Once I reverted this change, everything just worked.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create-react-app files/folders structure explained - Medium
When we use create-react-app tool it creates a hierarchy of files and folder. In this article we are going to have a look...
Read more >
reactjs - public, src,and scripts folder not created while using ...
Go to other Folders of your computer(like documents, Downloads) and then Create a folder for your app and Open it with VsCode(preferable) ·...
Read more >
create-react-app React File Structure - Pluralsight
Create a New React Project. To create a new app/project using this tool, all we need to do is run the command "create-react-app"...
Read more >
Using the Public Folder - Create React App
Only files inside the public folder will be accessible by %PUBLIC_URL% prefix. If you need to use a file from src or node_modules...
Read more >
Create React App: A quick setup guide - LogRocket Blog
You have two options when adding images, styles or by using other files (like fonts):. The src folder, using the module system; The...
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