unjs/unimport

Support for Astro JS

Opened this issue · 1 comments

Describe the feature

I have tried using unimport with Astro JS. The plugin works perfectly well in .js(x)- and .ts(x)-files, but not in .astro-files. It simply says X is not defined. I have tried investigating the issue, but I have been unable to find and explanation thus far. Maybe someone else will be able to implement a solution.

Additional information

  • Would you be willing to help implement this feature?

You can just configure the include option to add .astro:

export interface UnimportPluginOptions extends UnimportOptions {
include: FilterPattern
exclude: FilterPattern
dts: boolean | string
/**
* Enable implicit auto import.
* Generate global TypeScript definitions.
*
* @default true
*/
autoImport?: boolean
}
export const defaultIncludes = [/\.[jt]sx?$/, /\.vue$/, /\.vue\?vue/, /\.svelte$/]
export const defaultExcludes = [/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/]