unplugin-auto-import
unplugin-auto-import copied to clipboard
How to rename a variable and continue importing all
Describe the bug
` //a.js export function a() {} export function b() {} ...
// AutoImport
AutoImport({ imports: [ { 'a.js': [ 'a': 'A' ] } ]
}) ` At this point, b and other variables cannot be imported How to continue importing b and other variables without renaming them?
Reproduction
Perhaps this is not necessary
System Info
win10
Used Package Manager
npm
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.
I am wondering if it would be a good idea to provide a callback that allows users to confirm whether the alias feature is needed. Currently, I am duplicating the configuration for the items that are being used.
I have obtained the configuration information for Vue
from unimport
and applied some filtering. This is necessary because the h variable is automatically imported into the local package, causing variable conflicts.
const { builtinPresets } = require("unimport");
AutoImport({
imports: [
{
vue: builtinPresets.vue.imports
.filter((v) => v !== "h")
.concat([["h", "HAliasName"]]),
},
],
}),
I have obtained the configuration information for
Vue
fromunimport
and applied some filtering. This is necessary because the h variable is automatically imported into the local package, causing variable conflicts.const { builtinPresets } = require("unimport"); AutoImport({ imports: [ { vue: builtinPresets.vue.imports .filter((v) => v !== "h") .concat([["h", "HAliasName"]]), }, ], }),
Thank you, but this is essentially exhaustive and does not have universality