Closed
Description
Feature request
What problem does this feature solve?
Currently, we can build a theme package following https://vuepress.vuejs.org/theme/writing-a-theme.html#directory-structure
We have to set the main
field of package.json
to index.js
.
If we could allow the main
field be something like lib/index.js
?
i.e. putting all theme files into a sub directory lib
:
themePackageRoot
├── lib # put all the theme files in
│ ├── global-components
│ │ └── xxx.vue
│ ├── components
│ │ └── xxx.vue
│ ├── layouts
│ │ ├── Layout.vue
│ │ └── 404.vue
│ ├── styles
│ │ ├── index.styl
│ │ └── palette.styl
│ ├── templates
│ │ ├── dev.html
│ │ └── ssr.html
│ ├── index.js
│ └── enhanceApp.js
├── docs # and some other sub directory that not related to the theme files
└── package.json # point "main" to "lib/index.js"
How should this be implemented in your opinion?
I find related code here:
vuepress/packages/@vuepress/core/lib/prepare/loadTheme.js
Lines 178 to 180 in 6146287
Change require.resolve(`${name}/package.json`)
to require.resolve(name)
may help, but I'm not sure if it will cause any side effects.
Metadata
Metadata
Assignees
Labels
No labels