fix(pages): exclude 不生效,配置地方错了,要陪在vite.config.ts

This commit is contained in:
Burt 2024-01-04 13:37:58 +08:00
parent a266441305
commit 83e19e8eb2
4 changed files with 2 additions and 14 deletions

View File

@ -40,12 +40,6 @@ export default defineUniPages({
}, },
// 你也可以定义 pages 字段,它具有最高的优先级。 // 你也可以定义 pages 字段,它具有最高的优先级。
pages: [], pages: [],
/**
* exclude page
* dir subPackagescomponents里面的文件排除掉
* @default []
*/
exclude: ['**/components/**/**.*'],
/** /**
* subPackages src/pages-sub * subPackages src/pages-sub
* @type SubPackage[] | undefined * @type SubPackage[] | undefined

View File

@ -64,12 +64,7 @@
"backgroundColor": "#23c09c", "backgroundColor": "#23c09c",
"navigationStyle": "custom" "navigationStyle": "custom"
} }
},
{
"path": "pages/index/components/demo",
"type": "page"
} }
], ],
"exclude": ["**/components/**/**.*"],
"subPackages": [] "subPackages": []
} }

3
uni-pages.d.ts vendored
View File

@ -7,8 +7,7 @@ interface NavigateToOptions {
url: "pages/index/index" | url: "pages/index/index" |
"pages/demo/index" | "pages/demo/index" |
"pages/my/index" | "pages/my/index" |
"pages/throughout/index" | "pages/throughout/index";
"pages/index/components/demo";
} }
interface RedirectToOptions extends NavigateToOptions {} interface RedirectToOptions extends NavigateToOptions {}

View File

@ -45,7 +45,7 @@ export default ({ command, mode }) => {
return defineConfig({ return defineConfig({
plugins: [ plugins: [
// UniPages() 需要在 Uni() 之前引入 // UniPages() 需要在 Uni() 之前引入
UniPages(), UniPages({ exclude: ['**/components/**/**.*'] }),
Uni(), Uni(),
UnoCSS(), UnoCSS(),
process.env.UNI_PLATFORM === 'h5' && htmlPlugin(env.VITE_APP_TITLE), process.env.UNI_PLATFORM === 'h5' && htmlPlugin(env.VITE_APP_TITLE),