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,build之后出现报错? #30

Closed
6 tasks
Jairwin-L opened this issue Jul 4, 2021 · 5 comments
Closed
6 tasks

vite+react+antd,build之后出现报错? #30

Jairwin-L opened this issue Jul 4, 2021 · 5 comments
Labels
p3-minor-bug 🔨 An edge case that only affects very specific usage (priority)

Comments

@Jairwin-L
Copy link

Jairwin-L commented Jul 4, 2021

Describe the bug

使用antd的DatePicker组件点击时候出现问题,如图:
image

感谢🙏: @sodatea @Shinigami92 @underfin @psaren

Reproduction

https://github.com/Jairwin-L/vite-react-ts-demo/blob/077146486dcbd2965b6773bcf170dce5aabaec51/src/pages/demo.tsx#L25

System Info

"dependencies": {
		"antd": "^4.16.6",
		"antd-mobile": "^2.3.4",
		"indexof": "^0.0.1",
		"react": "^17.0.2",
		"react-dom": "^17.0.2",
		"react-router-dom": "^5.2.0"
	},
	"devDependencies": {
		"@types/node": "^14.14.31",
		"@types/react": "^17.0.0",
		"@types/react-dom": "^17.0.0",
		"@types/react-router-dom": "^5.1.7",
		"@vitejs/plugin-legacy": "^1.3.2",
		"@vitejs/plugin-react-refresh": "^1.3.2",
		"less": "^4.1.1",
		"typescript": "^4.1.2",
		"vite": "^2.3.6",
		"vite-plugin-cdn": "^1.0.0-beta.3",
		"vite-plugin-resolve-externals": "^0.1.0",
		"vite-plugin-style-import": "^0.7.6"
	}

Used Package Manager

yarn

Logs

ReferenceError: module is not defined

Validations

@benmccann

This comment has been minimized.

@benmccann

This comment has been minimized.

@raulfdm

This comment has been minimized.

@haoqunjiang
Copy link
Member

A simple workaround:
Add the following script tag in the index.html before the entry script:

<script>var module = {}</script>

It's a bug in the Rollup CommonJS plugin that doesn't fully recognize the code snippet used by moment to detect the CommonJS environment. I'll open an issue there.

@ArnaudBarre
Copy link
Member

Just tested with Vite@4 and react-plugin@3 the date picker work both in dev and preview

@github-actions github-actions bot locked and limited conversation to collaborators Feb 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p3-minor-bug 🔨 An edge case that only affects very specific usage (priority)
Projects
None yet
Development

No branches or pull requests

6 participants