Closed ultimateshadsform closed 1 month ago
I did
VueRouter({
routesFolder: [
{
src: 'entrypoints',
filePatterns: ['*/views/**/*'],
path: (file) => {
// Remove sub path /views/
return file.slice(file.lastIndexOf('views/') + 'views/'.length);
},
},
{
src: 'views',
},
],
extensions: ['.vue'],
exclude: ['**/components/**'],
dts: './types/typed-router.d.ts',
}),
And it seems to work. Please comment if this is not the correct way to do this.
Here is final version I did:
path: (file) => {
// Keep entrypoint and strip out /views/
const entrypoint = file.split('/entrypoints/')[1].split('/')[0];
const viewPath = file.slice(
file.lastIndexOf('/views/') + '/views/'.length
);
return `${entrypoint}/${viewPath}`;
},
I have global views in
views\About.vue
And page views in
entrypoints\newtab\views\index.vue
entrypoints\options\views\index.vue
Depending on the chrome extension view path.
How can I make it be /newtab/index.vue or /options/index.vue instead?
Here is my config:
Output results in:
How can I make it become
/newtab/
instead? How can I remove the /views/ from the path?In my main.ts I have: