mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(nuxt): relax server import protections (#5355)
Co-authored-by: pooya parsa <pyapar@gmail.com>
This commit is contained in:
parent
a3f8eca665
commit
247deacc2b
@ -20,7 +20,7 @@ export const vueAppPatterns = (nuxt: Nuxt) => [
|
|||||||
[new RegExp(`^${escapeRE(m)}$`), 'Importing directly from module entry points is not allowed.']),
|
[new RegExp(`^${escapeRE(m)}$`), 'Importing directly from module entry points is not allowed.']),
|
||||||
...[/(^|node_modules\/)@nuxt\/kit/, /^nitropack/]
|
...[/(^|node_modules\/)@nuxt\/kit/, /^nitropack/]
|
||||||
.map(i => [i, 'This module cannot be imported in the Vue part of your app.']),
|
.map(i => [i, 'This module cannot be imported in the Vue part of your app.']),
|
||||||
[new RegExp(escapeRE(resolve(nuxt.options.srcDir, (nuxt.options.dir as any).server || 'server'))), 'Importing from server middleware is not allowed in the Vue part of your app.']
|
[new RegExp(escapeRE(resolve(nuxt.options.srcDir, (nuxt.options.dir as any).server || 'server')) + '\\/(api|routes|middleware|plugins)\\/'), 'Importing from server is not allowed in the Vue part of your app.']
|
||||||
] as ImportProtectionOptions['patterns']
|
] as ImportProtectionOptions['patterns']
|
||||||
|
|
||||||
export const ImportProtectionPlugin = createUnplugin(function (options: ImportProtectionOptions) {
|
export const ImportProtectionPlugin = createUnplugin(function (options: ImportProtectionOptions) {
|
||||||
|
Loading…
Reference in New Issue
Block a user