Nuxt@3.0.0-rc.4 has a module called autoImportsModule that will auto import helper functions, composables and Vue APIs.
This is how auto import works.
First, in the function loadNuxt(opts), nuxt.config.ts will be loaded by another function loadNuxtConfig(opts), then the module autoImportsModule will be pushed into options._modules. Later, when the function nuxt.ready() is called, all modules in modulesToInstall (including nuxt.options._modules) will be installed by function installModule.
The problem is that the configuration file (nuxt.config.ts) will be loaded first, then auto-import will be done. So nuxt functions like defineNuxtPlugin can not be used in the configuration file. If someone attempt to use those functions in the configuration file, and use this plugin and add globals to silent the ESLint no-undef rule, those functions still cannot be used.
Maybe I need to find a way other than just setting globals, or find a way to apply globals setting on Nuxt configuration files.
Nuxt@3.0.0-rc.4
has a module calledautoImportsModule
that will auto import helper functions, composables and Vue APIs.This is how auto import works.
First, in the function
loadNuxt(opts)
,nuxt.config.ts
will be loaded by another functionloadNuxtConfig(opts)
, then the moduleautoImportsModule
will be pushed intooptions._modules
. Later, when the functionnuxt.ready()
is called, all modules inmodulesToInstall
(includingnuxt.options._modules
) will be installed by functioninstallModule
.The problem is that the configuration file (
nuxt.config.ts
) will be loaded first, then auto-import will be done. So nuxt functions likedefineNuxtPlugin
can not be used in the configuration file. If someone attempt to use those functions in the configuration file, and use this plugin and add globals to silent the ESLintno-undef
rule, those functions still cannot be used.Maybe I need to find a way other than just setting globals, or find a way to apply globals setting on Nuxt configuration files.