You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Configure the site's config.js to use a theme from a dependency package (such that resolveModule is called within @vuepress/shared-utils/lib/shortcutPackageResolver.js)
Do not add an index.js to the theme
What is expected?
No problems
What is actually happening?
An exception is thrown, as index.js is required for require.resolve to find the package. While this is not stated by the error shown below itself, we get to this point since require.resolve will simple return null in this case and shortcutPackageResolver will return whatever require.resolve returned, causing therefore later lines of code to fail.
TypeError: Cannot read property 'endsWith' of null
at loadTheme (xyz\node_modules\@vuepress\core\lib\prepare\loadTheme.js:51:20)
at AppContext.resolveTheme (xyz\node_modules\@vuepress\core\lib\prepare\AppContext.js:265:32)
at AppContext.process (xyz\node_modules\@vuepress\core\lib\prepare\AppContext.js:72:16)
at prepare (xyz\node_modules\@vuepress\core\lib\prepare\index.js:15:20)
at dev (xyz\node_modules\@vuepress\core\lib\dev.js:23:25)
at args (xyz\node_modules\@vuepress\cli\index.js:120:14)
at Command.program.command.description.option.option.option.option.option.option.action (xyz\node_modules\@vuepress\cli\index.js:50:23)
at Command.listener (xyz\node_modules\@vuepress\cli\node_modules\commander\index.js:315:8)
at Command.emit (events.js:182:13)
at Command.parseArgs (xyz\node_modules\@vuepress\cli\node_modules\commander\index.js:654:12)
Other relevant information
This is mostly a bug with the documentation, as it currently states that index.js is optional (aka not needed, see https://vuepress.vuejs.org/theme/#directory-structure). However, if the theme is to be loaded from a package, at least an empty index.js is needed.
The text was updated successfully, but these errors were encountered:
Bug report
Version
1.0.0-alpha.9
Steps to reproduce
config.js
to use a theme from a dependency package (such thatresolveModule
is called within@vuepress/shared-utils/lib/shortcutPackageResolver.js
)index.js
to the themeWhat is expected?
No problems
What is actually happening?
An exception is thrown, as
index.js
is required forrequire.resolve
to find the package. While this is not stated by the error shown below itself, we get to this point sincerequire.resolve
will simple returnnull
in this case andshortcutPackageResolver
will return whateverrequire.resolve
returned, causing therefore later lines of code to fail.Other relevant information
This is mostly a bug with the documentation, as it currently states that
index.js
is optional (aka not needed, see https://vuepress.vuejs.org/theme/#directory-structure). However, if the theme is to be loaded from a package, at least an emptyindex.js
is needed.The text was updated successfully, but these errors were encountered: