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

使用插件就报错,不使用可以正常打包 #6

Closed
Tyh2001 opened this issue Oct 19, 2022 · 3 comments
Closed

使用插件就报错,不使用可以正常打包 #6

Tyh2001 opened this issue Oct 19, 2022 · 3 comments

Comments

@Tyh2001
Copy link

Tyh2001 commented Oct 19, 2022

描述

我在 fighting-design 项目中使用了 vite-plugin-progress,使用插件打包就报错,不使用可以正常打包,报的是路径的错误。

错误截图

56702529e373187ddd34f451ca43269

复现步骤

import progress from 'vite-plugin-progress'

export default {
  plugins: [progress()],
}
  • pnpm build

可以发现,使用插件之后打包报错,不使用的话就不会报错

@Tyh2001
Copy link
Author

Tyh2001 commented Oct 19, 2022

@jeddygong

@jeddygong
Copy link
Owner

@Tyh2001
Hi, 因为打包入口默认是 src,由于你的是一个 monorepo,所以需要加一个 srcDir(详见更多 options),看起来就像下面的代码一样:

import progress from 'vite-plugin-progress'

export default {
  plugins: [
    progress({
      srcDir: 'packages/fighting-design'
    })
  ],
}

WX20221023-164234@2x

@Tyh2001
Copy link
Author

Tyh2001 commented Oct 23, 2022

@Tyh2001 Hi, 因为打包入口默认是 src,由于你的是一个 monorepo,所以需要加一个 srcDir(详见更多 options),看起来就像下面的代码一样:

import progress from 'vite-plugin-progress'

export default {
  plugins: [
    progress({
      srcDir: 'packages/fighting-design'
    })
  ],
}
WX20221023-164234@2x

👍👍

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