Skip to content

Commit 4eea740

Browse files
committed
fix(content): revert pages to only app as layers also inherit it
1 parent 3f59d4a commit 4eea740

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

src/internal-context/load.ts

+10-12
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,17 @@ const createInternalContext = async (moduleOptions: ModuleOptions, nuxt = useNux
7676
if (!importDirs.includes(utilsDir)) importDirs.push(utilsDir)
7777

7878
const isLayer = rootDir !== nuxt.options.rootDir
79-
const rootProjectFiles: string[] = []
8079

81-
if (!isLayer) {
82-
const pageFiles = pagesContentPath.tryUse()
80+
const pagePaths: string[] = []
81+
const pageFiles = pagesContentPath.tryUse()
8382

84-
if (moduleOptions.experimental?.strictScanContentPaths && pageFiles && pageFiles.length) {
85-
// replace filenames like [...path].vue with ?...path?.vue because [ and ] are reserved in glob matching
86-
rootProjectFiles.push(...pageFiles.map(p => p.replaceAll(/\[(\.+)([^.].*)\]/g, '?$1$2?')))
87-
}
88-
// @ts-expect-error pages can be an object
89-
else if (nuxtOptions.pages !== false && nuxtOptions.pages?.enabled !== false) {
90-
rootProjectFiles.push(withSrcDir(`${nuxtOptions.dir?.pages || 'pages'}/**/*${sfcExtensions}`))
91-
}
83+
if (moduleOptions.experimental?.strictScanContentPaths && pageFiles && pageFiles.length) {
84+
// replace filenames like [...path].vue with ?...path?.vue because [ and ] are reserved in glob matching
85+
if (!isLayer) pagePaths.push(...pageFiles.map(p => p.replaceAll(/\[(\.+)([^.].*)\]/g, '?$1$2?')))
86+
}
87+
// @ts-expect-error pages can be an object
88+
else if (nuxtOptions.pages !== false && nuxtOptions.pages?.enabled !== false) {
89+
pagePaths.push(withSrcDir(`${nuxtOptions.dir?.pages || 'pages'}/**/*${sfcExtensions}`))
9290
}
9391

9492
const componentPaths: string[] = []
@@ -120,7 +118,7 @@ const createInternalContext = async (moduleOptions: ModuleOptions, nuxt = useNux
120118
nuxtOptions.dir?.layouts && withSrcDir(`${nuxtOptions.dir.layouts}/**/*${sfcExtensions}`),
121119
nuxtOptions.dir?.plugins && withSrcDir(`${nuxtOptions.dir.plugins}/**/*${defaultExtensions}`),
122120
...importDirs.map(d => `${d}/**/*${defaultExtensions}`),
123-
...rootProjectFiles,
121+
...pagePaths,
124122

125123
withSrcDir(`{A,a}pp${sfcExtensions}`),
126124
withSrcDir(`{E,e}rror${sfcExtensions}`),

0 commit comments

Comments
 (0)