unplugin-auto-import
unplugin-auto-import copied to clipboard
Package name with dot is not imported properly
Describe the bug
When I try to import twin.macro:
AutoImport({
dirs: [],
imports: [
"react",
"react-router-dom",
{
...,
"twin.macro": [["default", "tw"], "css", "styled", "theme"],
},
],
eslintrc: {
enabled: true,
},
}),
it generates the following code:
// Should be 'twin.macro'
const styled: typeof import('twin')['styled']
const theme: typeof import('twin')['theme']
const tw: typeof import('twin')['default']
const css: typeof import('twin')['css']
As you can see, it removes the dot and the following string.
Reproduction
https://stackblitz.com/edit/vitejs-vite-nercgp?file=auto-imports.d.ts
System Info
System:
OS: Windows 11 10.0.22631
CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
Memory: 11.30 GB / 31.71 GB
Binaries:
Node: 18.18.2 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.19 - C:\Program Files\nodejs\yarn.CMD
npm: 10.2.1 - C:\Program Files\nodejs\npm.CMD
pnpm: 8.11.0 - C:\Program Files\nodejs\pnpm.CMD
Browsers:
Edge: Chromium (120.0.2210.91)
Internet Explorer: 11.0.22621.1
Used Package Manager
pnpm
Validations
- [X] Follow our Code of Conduct
- [x] Read the Contributing Guide.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
- [X] The provided reproduction is a minimal reproducible of the bug.
We temporarily closed this due to the lack of enough information. We could not identify whether it was a bug or a userland misconfiguration with the given info. Please provide a minimal reproduction to reopen the issue. Thanks.
Hi antfu,
Here is the repro link: https://stackblitz.com/edit/vitejs-vite-nercgp?file=auto-imports.d.ts