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.

BaseUrl not respected with new create-react-app 3.0 version

See original GitHub issue

Describe the bug Even better here is a repro case -> https://github.com/SpearThruster/storybook5-and-create-react-app3

To Reproduce

  1. clone repo
  2. npm install
  3. npm run storybook

Expected behavior The baseUrl should be respected and the component path import { RoundedButton } from "components/RoundedButton" should be resolved.

Screenshots not applicable

Code snippets If applicable, add code samples to help explain your problem.

System:

  • OS: [Windows10]
  • Browser: [chrome]
  • Framework: [react]
  • Version: tried 5.0,0 but also the 5.1.0 alpha version

Additional context Tried various combinations from the docs regarding TypeScript + storybook (with cra) to no avail.

** console output

ERROR in ./src/stories/index.stories.tsx Module not found: Error: Can't resolve 'components/RoundedButton' in 'D:\Projects\storybook5-and-create-react-app3\src\stories' @ ./src/stories/index.stories.tsx 5:0-57 9:29-42 25:29-42 @ ./src sync .stories.tsx$ @ ./.storybook/config.ts @ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/config.ts (webpack)-hot-middleware/client.js?reload=true

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:33 (18 by maintainers)

github_iconTop GitHub Comments

2reactions
egor-xyzcommented, May 8, 2019
"storybook": "NODE_PATH=src start-storybook -p 9009 -s public",
2reactions
mrmckebcommented, Apr 24, 2019

Closing this as all issues seem to be resolved. Thanks everyone for your time here 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to change base url of create react app? - Stack Overflow
In your package.json file change the homepage entry to a relative path, excluding any sub-domain/nested directory.
Read more >
jsconfig.json not working react - You.com | The AI Search ...
According to Create React App documentation about absolute imports you should be able to ... ESLint respecting VS Code jsconfig.json baseUrl and paths....
Read more >
Changelog - Cypress Documentation
The tsConfig build option is now respected for Angular component tests. ... The baseUrl and experimentalSessionAndOrigin configuration options are no longer ...
Read more >
Vite 3.0 vs. Create React App: Comparison and migration guide
Learn how to build React applications with Vite and how to migrate from Create React App to Vite. Compare the core concepts of...
Read more >
URL | Node.js v19.3.0 Documentation
base <string> The base URL to resolve against if the input is not absolute. If base is not a string, it is converted...
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