From b12fe7eb7c60b1c393377fca181580ce54c0a9d7 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 1 Aug 2022 18:25:31 +0100 Subject: [PATCH] fix(nuxt): narrow `nuxt.config` import protection (#6279) --- packages/nuxt/src/core/plugins/import-protection.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nuxt/src/core/plugins/import-protection.ts b/packages/nuxt/src/core/plugins/import-protection.ts index 3826ff6b6b..2646b3dd78 100644 --- a/packages/nuxt/src/core/plugins/import-protection.ts +++ b/packages/nuxt/src/core/plugins/import-protection.ts @@ -15,7 +15,7 @@ interface ImportProtectionOptions { export const vueAppPatterns = (nuxt: Nuxt) => [ [/^(nuxt3|nuxt)$/, '`nuxt3`/`nuxt` cannot be imported directly. Instead, import runtime Nuxt composables from `#app` or `#imports`.'], - [/nuxt\.config/, 'Importing directly from a `nuxt.config` file is not allowed. Instead, use runtime config or a module.'], + [/^((|~|~~|@|@@)\/)?nuxt\.config(\.|$)/, 'Importing directly from a `nuxt.config` file is not allowed. Instead, use runtime config or a module.'], [/(^|node_modules\/)@vue\/composition-api/], ...nuxt.options.modules.filter(m => typeof m === 'string').map((m: string) => [new RegExp(`^${escapeRE(m)}$`), 'Importing directly from module entry points is not allowed.']),