[Bug] Regression with resolve.alias as array
See original GitHub issueWhat version of vite
are you using?
2.9.13
System info and storybook versions
System:
OS: macOS 12.3.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Binaries:
Node: 14.17.6 - ~/.nvm/versions/node/v14.17.6/bin/node
Yarn: 1.22.11 - ~/.nvm/versions/node/v14.17.6/bin/yarn
npm: 8.5.1 - ~/.nvm/versions/node/v14.17.6/bin/npm
Browsers:
Chrome: 103.0.5060.53
Safari: 15.4
npmPackages:
@storybook/addon-actions: 6.5.0 => 6.5.0
@storybook/addon-essentials: 6.5.0 => 6.5.0
@storybook/addon-links: 6.5.0 => 6.5.0
@storybook/builder-vite: 0.1.37 => 0.1.37
@storybook/node-logger: 6.5.0 => 6.5.0
@storybook/react: 6.5.0 => 6.5.0
Describe the Bug
I found regression in 0.1.37, perhaps in this line
(packages/builder-vite/code-generator-plugin.ts:70)
I have configured Vite to have resolve.alias
as array, so ie.
resolve: {
alias: [
{
find: 'features',
replacement: resolve(__dirname, 'src', 'features'),
},
{
find: /(@fontsource)/,
replacement: 'node_modules/$1',
},
],
},
And because of that i cant run storybook because many errors like
ERROR The following dependencies are imported but could not be resolved:
features/products/components/ProductAttributesDropdown (imported by /Users/bla/workspace/black/src/features/products/components/ProductOptions/ProductAttributeEdit.tsx)
Are they installed?
Last version without this issue is 0.1.36. I am on React 17
Please add support for arrays as well
Link to Minimal Reproducible Example
No response
Participation
- I am willing to submit a pull request for this issue.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Feature: resolve alias array of directories · Issue #6817 - GitHub
Do you want to request a feature or report a bug? Feature. What is the current behaviour? Alias accepts single directory path.
Read more >Resolve | webpack
resolve.alias. object. Create aliases to import or require certain modules more easily. For example, to alias a bunch of commonly used src/ folders:....
Read more >Resolve - webpack
Create aliases to import or require certain modules more easily. ... array. Automatically resolve certain extensions. This defaults to:
Read more >Why does VSCode's "Go to definition" fail on my project using ...
Accepted answer is correct, except my solution was simply: import something from '~/something';. jsconfig.json looks like this:
Read more >59124 – [6 Regression] Wrong warnings "array subscript is ...
I'll go ahead and resolve this as fixed. I suggest to open a separate bug for any new/outstanding issues in this area to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes, I mean
vite.config.ts
Yes, viteFinal is merged configThank you very much 🙂