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

vite+react+antd-mobile,build之后出现报错系列? #3037

Closed
Jairwin-L opened this issue Apr 18, 2021 · 9 comments
Closed

vite+react+antd-mobile,build之后出现报错系列? #3037

Jairwin-L opened this issue Apr 18, 2021 · 9 comments

Comments

@Jairwin-L
Copy link

Jairwin-L commented Apr 18, 2021

Describe the bug

package.json

"devDependencies": {
  "@vitejs/plugin-react-refresh": "^1.3.2",
  "vite": "^2.1.5",
}

dev正常,build之后报错如下:
image

@github-actions
Copy link

Hello @Jairwin-L. Please provide a online reproduction by codesandbox or a minimal GitHub repository. Issues labeled by need reproduction will be closed if no activities in 3 days.

@lichenbuliren
Copy link

单独安装一个依赖包:npm install indexof 能解决这个问题

@psaren
Copy link
Contributor

psaren commented Apr 19, 2021

This issue maybe duplicate with #2670.

@Jairwin-L
Copy link
Author

Jairwin-L commented Apr 20, 2021

单独安装一个依赖包:npm install indexof 能解决这个问题

好像不行:
reproduction repo:https://github.com/Jairwin-L/vite-react-ts-demo

@vitejs vitejs deleted a comment from Jairwin-L Apr 20, 2021
@vitejs vitejs deleted a comment from Jairwin-L Apr 20, 2021
@haoqunjiang
Copy link
Member

build.rollupOptions.external 的配置去掉就行了。

@Jairwin-L
Copy link
Author

Jairwin-L commented Jun 3, 2021

@Jairwin-L Jairwin-L changed the title vite+react+antd-mobile,build之后出现报错? vite+react+antd-mobile,build之后出现报错系列? Jun 3, 2021
@Shinigami92 Shinigami92 reopened this Jun 3, 2021
@haoqunjiang
Copy link
Member

{
  build: {
    commonjsOptions: {
      transformMixedEsModules: true
    }
  }
}

@haoqunjiang haoqunjiang added bug p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage bug p3-minor-bug An edge case that only affects very specific usage (priority) labels Jun 4, 2021
@haoqunjiang
Copy link
Member

这个选项虽然能暂时绕开问题,但并不建议开启。最好是由上游依赖修复。
参见:#648 (comment)

@github-actions
Copy link

This issue gets locked because it has been closed for more than 14 days.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 13, 2021
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

6 participants