Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug report] 1.0.0-alpha.40 breaks #1204, #1206 #1362

Closed
1 task done
meteorlxy opened this issue Feb 27, 2019 · 2 comments
Closed
1 task done

[Bug report] 1.0.0-alpha.40 breaks #1204, #1206 #1362

meteorlxy opened this issue Feb 27, 2019 · 2 comments

Comments

@meteorlxy
Copy link
Member

  • I confirm that this is a issue rather than a question.

Bug report

Version

1.0.0-alpha.40

Steps to reproduce

d16d3d5#diff-56a897e96a354a8b8ea86dc24074ad5bR61

    const pkgPath = require.resolve(name)
    let packageRootDir = parse(pkgPath).dir
    // For those cases that "main" field was set to non-index file
    // e.g. `layouts/Layout.vue`
    while (!fs.existsSync(`${packageRootDir}/package.json`)) {
      packageRootDir = resolve(packageRootDir, '..')
    }

What is expected?

Allow "main" field to be set to something like lib/index.js (As explained in #1204 )

In such case, the packageRootDir should be <pkgDir>/lib/

What is actually happening?

The packageRootDir is <pkgDir> now.

@ulivz
Copy link
Member

ulivz commented Feb 27, 2019

There is another more important case for now, a 0.x user would want to migrate his/her theme to 1.x and doesn't have themeEntry, so he need set the "main" field to layouts/Layout.vue. so we need to retrieve the correct theme path.

For your case you can try:

module.exports = {
   theme: require.resolve('vuepres-theme-xxx/lib')
}

@ulivz ulivz closed this as completed Feb 27, 2019
@meteorlxy
Copy link
Member Author

meteorlxy commented Feb 27, 2019

@ulivz

Emmm.. As I remembered, 0.x theme does not allow users to set the "main" field to layouts/Layout.vue

themeLayoutPath = require.resolve(`vuepress-theme-${siteConfig.theme}/Layout.vue`, {

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants