Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6.1: Module resolution with baseUrl #13184

Open
Quadriphobs1 opened this issue Nov 20, 2020 · 13 comments
Open

6.1: Module resolution with baseUrl #13184

Quadriphobs1 opened this issue Nov 20, 2020 · 13 comments

Comments

@Quadriphobs1
Copy link

Quadriphobs1 commented Nov 20, 2020

Describe the bug
Upgrading to 6.1 failed to compile Module not found: Error: Can't resolve 'components/**/**' when using baseUrl with typescript, also fails using alias with typescript. It obviously

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
I think storybook should use the project supplied tsconfig/jsconfig and maybe merge alongside any overrides, if its possible to probably do merging at this step info => Removing existing JavaScript and TypeScript rules. instead of removing, this would potentially make it more flexible to any environment

@Quadriphobs1
Copy link
Author

A quick fix is to use tsconfig-paths-webpack-plugin to extend the tsconfig in the main.js. But it would be better if probably from the CLI a user can option to specify a typescript config or jsconfig file which I believe webpack would use internally.

const { TsconfigPathsPlugin } = require('tsconfig-paths-webpack-plugin')

module.exports = {
  webpackFinal: async (config) => {
    config.resolve.plugins = [new TsconfigPathsPlugin({ extensions: config.resolve.extensions })]
    return config
  },
 ...
};

@shilman
Copy link
Member

shilman commented Nov 20, 2020

@Quadriphobs1 what version are you upgrading from?

@Quadriphobs1
Copy link
Author

@shilman ^6.0.28

@shilman
Copy link
Member

shilman commented Nov 20, 2020

How were you able to get it working in 6.0.28?

@Quadriphobs1
Copy link
Author

Quadriphobs1 commented Nov 20, 2020

It works with 6.0.28... I am not sure why... But it does work...

@stale
Copy link

stale bot commented Dec 25, 2020

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Dec 25, 2020
@bodinsamuel
Copy link

Thanks for the solution, adding TsconfigPathsPlugin worked for me (version 6.1.15)

@ghost
Copy link

ghost commented Mar 23, 2021

I had to use TsConfigPathsPlugin to use Storybook with my app. So did this fella in a different issue. Here's the place in the docs that needs to be updated with this workaround: https://storybook.js.org/docs/react/configure/webpack

@shilman
Copy link
Member

shilman commented Mar 23, 2021

@balibebas any interest in submitting a PR with the update?

@ghost
Copy link

ghost commented Mar 24, 2021

@balibebas any interest in submitting a PR with the update?

Can do. But I'd like to answer this question before laying down a suggestion in the docs. #14087 (comment)

@shilman
Copy link
Member

shilman commented Mar 24, 2021

@balibebas sorry, I didn't see a question ... what am I missing? 😄

@ghost
Copy link

ghost commented Mar 24, 2021

@balibebas sorry, I didn't see a question ... what am I missing? 😄

Seeing as how I linked to your own comment I can see how that could be confusing. I've updated the link above to link to the related issue with the question. Whoops! :D

@ghost
Copy link

ghost commented Mar 29, 2021

@shilman subbed pull #14371 with the pattern you left in #14087. thanks for cleaning up the code 👍🏼

@shilman shilman removed the PN label Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants