|
@@ -9,7 +9,7 @@ export default defineConfig({
|
|
|
tailwindcss(),
|
|
tailwindcss(),
|
|
|
md({
|
|
md({
|
|
|
marked: {},
|
|
marked: {},
|
|
|
- include: ['../mds/**/*.md', './src/pages/guide/**/*.md', '../../packages/**/*.md']
|
|
|
|
|
|
|
+ include: ['../mds/**/*.md', '../../packages/**/*.md']
|
|
|
})
|
|
})
|
|
|
],
|
|
],
|
|
|
server: { hmr: true, host: '0.0.0.0', port: 5555 },
|
|
server: { hmr: true, host: '0.0.0.0', port: 5555 },
|
|
@@ -22,62 +22,22 @@ export default defineConfig({
|
|
|
if (id.includes('node_modules')) {
|
|
if (id.includes('node_modules')) {
|
|
|
return 'vendor/index';
|
|
return 'vendor/index';
|
|
|
}
|
|
}
|
|
|
- // 将 src/components/menu 中的包拆分到单独的 build/common/menu/index.js 文件中
|
|
|
|
|
- if (id.includes('site/src/components/menu')) {
|
|
|
|
|
- return 'common/menu/index';
|
|
|
|
|
|
|
+ // 将 sr/lib 中的包拆分到单独的 build/lib/ 文件中
|
|
|
|
|
+ if (id.includes('src/lib/')) {
|
|
|
|
|
+ return 'lib/index';
|
|
|
}
|
|
}
|
|
|
- // 将 src/pages/Home.svelte 单独拆分到 build/home/index.js 文件中
|
|
|
|
|
- if (id.includes('src/pages/Home.svelte')) {
|
|
|
|
|
|
|
+ // 将 src/routes/+page.svelte 单独拆分到 build/home/index.js 文件中
|
|
|
|
|
+ if (id.includes('src/routes/+page.svelte')) {
|
|
|
return 'home/index';
|
|
return 'home/index';
|
|
|
}
|
|
}
|
|
|
- // 将 src/pages/guide/Guide.svelte 单独拆分到 build/guide/index.js 文件中
|
|
|
|
|
- if (id.includes('src/pages/guide/Guide.svelte')) {
|
|
|
|
|
|
|
+ // 将 src/routes/guide 单独拆分到 build/guide/index.js 文件中
|
|
|
|
|
+ if (id.includes('src/routes/guide')) {
|
|
|
return 'guide/index';
|
|
return 'guide/index';
|
|
|
}
|
|
}
|
|
|
- const guide = [
|
|
|
|
|
- 'QuickStart',
|
|
|
|
|
- 'Theme',
|
|
|
|
|
- 'Faq',
|
|
|
|
|
- 'Color',
|
|
|
|
|
- 'Color_en',
|
|
|
|
|
- 'Icon',
|
|
|
|
|
- 'Internation',
|
|
|
|
|
- 'Compatibility',
|
|
|
|
|
- 'Logo',
|
|
|
|
|
- 'About',
|
|
|
|
|
- 'Changelog',
|
|
|
|
|
- 'Future',
|
|
|
|
|
- 'Shortkey',
|
|
|
|
|
- 'Contribution',
|
|
|
|
|
- 'Milestone',
|
|
|
|
|
- 'Vscode',
|
|
|
|
|
- 'Generator'
|
|
|
|
|
- ];
|
|
|
|
|
- // 循环遍历 guide 文件夹下的所有文件,将其单独拆分到 build/guide/xxx/index.js 文件中
|
|
|
|
|
- for (const item of guide) {
|
|
|
|
|
- if (id.includes(`src/pages/guide/${item}.svelte`)) {
|
|
|
|
|
- return `guide/${item}/index`;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- // 将 src/pages/components/Components.svelte 单独拆分到 build/components/index.js 文件中
|
|
|
|
|
- if (id.includes('src/pages/components/Components.svelte')) {
|
|
|
|
|
|
|
+ // 将 src/routes/components 单独拆分到 build/components/index.js 文件中
|
|
|
|
|
+ if (id.includes('src/routes/components')) {
|
|
|
return 'components/index';
|
|
return 'components/index';
|
|
|
}
|
|
}
|
|
|
- const components = ['Api', 'Component', 'FAQ', 'Guide', 'Version'];
|
|
|
|
|
- // 循环遍历 components 文件夹下的所有文件,将其单独拆分到 build/components/xxx/index.js 文件中
|
|
|
|
|
- for (const item of components) {
|
|
|
|
|
- if (id.includes(`src/pages/components/${item}.svelte`)) {
|
|
|
|
|
- return `components/${item}/index`;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- // 如果 id 包含 doc/guide/xxx.md 则单独拆分到 build/doc/guide/xxx/index.js 文件中
|
|
|
|
|
- if (id.includes('doc/guide/')) {
|
|
|
|
|
- return 'doc/guide/' + id.match(/doc\/guide\/(.*)\.md/)?.[1] + '/index';
|
|
|
|
|
- }
|
|
|
|
|
- // 如果 id 包含 doc/components/xxx.md 则单独拆分到 build/doc/components/xxx/index.js 文件中
|
|
|
|
|
- if (id.includes('doc/components/')) {
|
|
|
|
|
- return 'doc/components/' + id.match(/doc\/components\/(.*)\.md/)?.[1] + '/index';
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|