File tree Expand file tree Collapse file tree 8 files changed +93
-75
lines changed
Expand file tree Collapse file tree 8 files changed +93
-75
lines changed Original file line number Diff line number Diff line change @@ -24,4 +24,3 @@ components.d.ts
2424
2525# test
2626valaxy-blog
27-
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ test.describe('enter docs', () => {
1414 // Click the get started button
1515 await page . click ( '.sese-btn' )
1616 // wait page load
17- await page . waitForURL ( ` ${ env . docs } /guide/getting-started` )
17+ await page . waitForURL ( ' /guide/getting-started' )
1818 // Expect a new url
1919 await expect ( page . locator ( 'h1' ) ) . toHaveText ( 'Getting Started' )
2020 } )
Original file line number Diff line number Diff line change @@ -86,9 +86,19 @@ export function getRollupOptions(options: ResolvedValaxyOptions) {
8686 ) } `,
8787 )
8888
89+ const assetsDir = 'assets'
8990 const rollupOptions : Rollup . RollupOptions = {
91+ ...options . config . vite ?. build ?. rollupOptions ,
9092 external : [ ] ,
93+ // important so that each page chunk and the index export things for each
94+ // other
95+ preserveEntrySignatures : 'allow-extension' ,
9196 output : {
97+ assetFileNames : `${ assetsDir } /[name].[hash].[ext]` ,
98+ entryFileNames : `${ assetsDir } /[name].[hash].js` ,
99+ chunkFileNames ( ) {
100+ return `${ assetsDir } /[name].[hash].js`
101+ } ,
92102 manualChunks ( id , ctx ) {
93103 // move known framework code into a stable chunk so that
94104 // custom theme changes do not invalidate hash for all pages
@@ -102,6 +112,7 @@ export function getRollupOptions(options: ResolvedValaxyOptions) {
102112 // lib
103113 const libs = [
104114 '@vueuse/motion' ,
115+
105116 'date-fns' ,
106117 'luxon' ,
107118 'vue-i18n' ,
Original file line number Diff line number Diff line change @@ -50,7 +50,11 @@ export const defaultValaxyConfig: ValaxyNodeConfig = {
5050 } ,
5151
5252 vite : {
53- build : { } ,
53+ build : {
54+ emptyOutDir : true ,
55+ // not inlined?
56+ cssCodeSplit : false ,
57+ } ,
5458 } ,
5559
5660 devtools : true ,
Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ const clientDeps = [
3131 // vue
3232 'vue' ,
3333 'vue-router' ,
34+ 'unplugin-vue-router/data-loaders/basic' ,
35+
3436 'vue-i18n' ,
3537 // dev
3638 '@vue/devtools-api' ,
@@ -90,7 +92,8 @@ export function createConfigPlugin(options: ResolvedValaxyOptions): Plugin {
9092 // root: options.userRoot,
9193 // can not transform valaxy/client/*.ts when use userRoot
9294 root : options . clientRoot ,
93- cacheDir : join ( options . userRoot , 'node_modules/.vite' ) ,
95+ // cacheDir: join(options.userRoot, 'node_modules/.vite'),
96+ cacheDir : join ( options . userRoot , 'node_modules/.valaxy/cache' ) ,
9497 publicDir : join ( options . userRoot , 'public' ) ,
9598
9699 define : getDefine ( options ) ,
@@ -121,7 +124,6 @@ export function createConfigPlugin(options: ResolvedValaxyOptions): Plugin {
121124 }
122125
123126 if ( isInstalledGlobally ) {
124- injection . cacheDir = join ( options . pkgRoot , 'node_modules/.vite' )
125127 // @ts -expect-error type cast
126128 injection . resolve . alias . vue = `${ resolveImportPath ( 'vue/dist/vue.esm-browser.js' , true ) } `
127129 }
Original file line number Diff line number Diff line change @@ -59,8 +59,10 @@ export function createTransformMarkdown(options: ResolvedValaxyOptions) {
5959
6060 const loaderVuePath = path . resolve ( options . pkgRoot , 'node/templates/loader.vue' )
6161 let loaderVue = fs . readFileSync ( loaderVuePath , 'utf-8' )
62+ const pagePath = pageData . relativePath . slice ( '/pages' . length - 1 , - '.md' . length )
6263 loaderVue = loaderVue
63- . replace ( '/relativePath' , pageData . relativePath . slice ( '/pages' . length - 1 , - '.md' . length ) )
64+ // adapt for /index
65+ . replace ( '/relativePath' , pagePath . endsWith ( 'index' ) ? pagePath . replace ( / \/ i n d e x $ / , '' ) : pagePath )
6466 . replace ( '// custom basic loader' , `return JSON.parse(\`${ JSON . stringify ( pageData ) } \`)` )
6567 code = loaderVue + code
6668
Original file line number Diff line number Diff line change 5252 "node" : " ^14.18.0 || >=16.0.0"
5353 },
5454 "scripts" : {
55- "build" : " rimraf dist && tsup --splitting " ,
55+ "build" : " rimraf dist && tsup" ,
5656 "dev" : " tsup --watch" ,
5757 "preview" : " vite preview" ,
5858 "preview-https" : " serve dist"
You can’t perform that action at this time.
0 commit comments