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

Cannot access 'DefaultTheme' before initialization #1210

Closed
3 tasks done
wuchaoxin opened this issue Aug 19, 2022 · 13 comments
Closed
3 tasks done

Cannot access 'DefaultTheme' before initialization #1210

wuchaoxin opened this issue Aug 19, 2022 · 13 comments

Comments

@wuchaoxin
Copy link

wuchaoxin commented Aug 19, 2022

MRE: brc-dd/vp-default-theme-bug


Describe the bug

I want to use element-plus.

I refer to the issue 603 and brc-dd/vitepress-element-plus-demo

It works in 1.0.0-alpha.4, but building in 1.0.0-alpha.8 gives an error

build error:
ReferenceError: Cannot access 'DefaultTheme' before initialization

Reproduction

In 1.0.0-alpha.8 version,create a file .vitepress\theme\index.js

import DefaultTheme from 'vitepress/theme'
import { install } from 'element-plus'
import 'element-plus/dist/index.css'

export default {
  ...DefaultTheme,
  enhanceApp({ app }) {
    install(app)
  }
}

Expected behavior

No error in building

System Info

System:
    OS: macOS 12.2.1
    CPU: (8) x64 Apple M1
    Memory: 29.13 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 14.19.1 - ~/.nvm/versions/node/v14.19.1/bin/node
    Yarn: 1.22.18 - /usr/local/bin/yarn
    npm: 6.14.16 - ~/.nvm/versions/node/v14.19.1/bin/npm
  Browsers:
    Chrome: 104.0.5112.101
    Safari: 15.3

Additional context

No response

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
@wuchaoxin wuchaoxin added the bug: pending triage Maybe a bug, waiting for confirmation label Aug 19, 2022
@Sepush
Copy link

Sepush commented Aug 20, 2022

get the same error when build it works fine on dev

@Sepush
Copy link

Sepush commented Aug 20, 2022

引入第三方组件库方式建议参考 vitepress-template

didn't use third party lib still get this error

@Tyh2001
Copy link

Tyh2001 commented Aug 20, 2022

引入第三方组件库方式建议参考 vitepress-template

@Tyh2001
Copy link

Tyh2001 commented Aug 20, 2022

引入第三方组件库方式建议参考 vitepress-template

didn't use third party lib still get this error

有项目地址吗?

@Sepush
Copy link

Sepush commented Aug 20, 2022

引入第三方组件库方式建议参考 vitepress-template

didn't use third party lib still get this error

有项目地址吗?

you can try to bump up you template to alpha8 I think you will get this error

@wuchaoxin
Copy link
Author

引入第三方组件库方式建议参考 vitepress-template

Your project version is 1.0.0-alpha.4, try using 1.0.0-alpha.8

你的项目版本号和描述不一致,请注意看下描述。

@Tyh2001
Copy link

Tyh2001 commented Aug 20, 2022

引入第三方组件库方式建议参考 vitepress-template

didn't use third party lib still get this error

有项目地址吗?

you can try to bump up you template to alpha8 I think you will get this error

不,经过我的测试,在 alpha8 版本中,构建会有错误,可以看下:
#1209

@Sepush
Copy link

Sepush commented Aug 20, 2022

引入第三方组件库方式建议参考 vitepress-template

didn't use third party lib still get this error

有项目地址吗?

you can try to bump up you template to alpha8 I think you will get this error

不,经过我的测试,在 alpha8 版本中,构建会有错误,可以看下: #1209

that's why we talk about here

@Tyh2001
Copy link

Tyh2001 commented Aug 20, 2022

应该是版本问题 先使用 alpha4 版本比较稳定一些

@brc-dd
Copy link
Member

brc-dd commented Aug 20, 2022

I am not able to reproduce this:

image

@Sepush
Copy link

Sepush commented Aug 20, 2022

I am not able to reproduce this:

image

https://github.com/Sepush/envd-docs/tree/up
try this branch
it work fine on dev mode but when I run pnpm docs:buid it will get this error
image

@brc-dd brc-dd added bug and removed bug: pending triage Maybe a bug, waiting for confirmation labels Aug 20, 2022
@wuchaoxin
Copy link
Author

I am not able to reproduce this:

image

This problem seems to be caused by Team Page. It works fine when I comment out Team Page.

@Sepush
Copy link

Sepush commented Aug 20, 2022

I am not able to reproduce this:
image

This problem seems to be caused by Team Page. It works fine when I comment out Team Page.

this also works for me seems this issue couse by VPTeamPage

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants