stormy-gold
stormy-gold2y ago

Vite preview error

Using antd, refine, vite builder and react after i build with vite I am getting error on vite preview
react_devtools_backend.js:2655 TypeError: pt.some is not a function
at InternalTable.js:86:17
at Object.sie [as useMemo] (react-dom.production.min.js:179:119)
at Pl.useMemo (react.production.min.js:25:208)
at Act (InternalTable.js:85:22)
at Gz (react-dom.production.min.js:167:137)
at FW (react-dom.production.min.js:193:57)
at Iie (react-dom.production.min.js:294:275)
at Pie (react-dom.production.min.js:280:389)
at Yke (react-dom.production.min.js:280:320)
at fT (react-dom.production.min.js:280:180)
react_devtools_backend.js:2655 TypeError: pt.some is not a function
at InternalTable.js:86:17
at Object.sie [as useMemo] (react-dom.production.min.js:179:119)
at Pl.useMemo (react.production.min.js:25:208)
at Act (InternalTable.js:85:22)
at Gz (react-dom.production.min.js:167:137)
at FW (react-dom.production.min.js:193:57)
at Iie (react-dom.production.min.js:294:275)
at Pie (react-dom.production.min.js:280:389)
at Yke (react-dom.production.min.js:280:320)
at fT (react-dom.production.min.js:280:180)
15 Replies
kapa.ai
kapa.ai2y ago
Hey @haribo_mushi! I'm the kapa.ai support bot. I've searched through the docs to try to answer your question. :wave:
kapa.ai
kapa.ai2y ago
---------------------- It looks like you are running into an error when using Refine, Ant Design, React, and Vite Builder. Based on the error message, it appears that you are using the InternalTable component from Refine. The error message indicates that the pt.some function is not being called correctly. This could be due to an incorrect import or an incorrect usage of the useMemo hook. To help you debug this issue, please refer to the Refine documentation (https://refine.dev/docs) for more information on the InternalTable component and the useMemo hook. Additionally, you can refer to the Ant Design documentation (https://ant.design/docs/react/introduce) for more information on how to use Ant Design components with React. ----------------------
kapa.ai
kapa.ai2y ago
<@886127984711438378> kapa.ai is still learning and improving, please let us how it did by reacting below
rising-crimson
rising-crimson2y ago
Hello @haribo_mushi , it looks like you are missing a package install, if that's not the case, can you give us more context so we can help you faster?
stormy-gold
stormy-goldOP2y ago
but it is working for me in the dev mode tho I am integrating sentry and trying to push my sourcemap
rising-crimson
rising-crimson2y ago
Perhaps it's installed into devDependencies by accident
stormy-gold
stormy-goldOP2y ago
{
"name": "client",
"version": "0.1.0",
"type": "module",
"private": true,
"dependencies": {
"@pankod/refine-antd": "^4.7.0",
"@pankod/refine-cli": "^1.2.0",
"@pankod/refine-core": "^3.18.0",
"@pankod/refine-inferencer": "^2.0.2",
"@pankod/refine-kbar": "^0.8.0",
"@pankod/refine-react-router-v6": "^3.18.0",
"@pankod/refine-simple-rest": "^3.18.0",
"@sentry/react": "^7.42.0",
"@sentry/tracing": "^7.42.0",
"@testing-library/jest-dom": "^5.12.0",
"@testing-library/react": "^11.2.6",
"@testing-library/user-event": "^12.8.3",
"@types/jest": "^26.0.23",
"child_process": "^1.0.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"web-vitals": "^1.1.1"
},
"devDependencies": {
"@sentry/cli": "^2.14.4",
"@types/node": "^18.15.3",
"@types/react": "^18.0.15",
"@types/react-dom": "^18.0.6",
"@vitejs/plugin-react": "^3.1.0",
"typescript": "^4.7.4",
"vite": "^4.1.1"
},
"scripts": {
"start": "vite",
"build": "tsc && vite build",
"preview": "vite preview",
"refine": "refine"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
{
"name": "client",
"version": "0.1.0",
"type": "module",
"private": true,
"dependencies": {
"@pankod/refine-antd": "^4.7.0",
"@pankod/refine-cli": "^1.2.0",
"@pankod/refine-core": "^3.18.0",
"@pankod/refine-inferencer": "^2.0.2",
"@pankod/refine-kbar": "^0.8.0",
"@pankod/refine-react-router-v6": "^3.18.0",
"@pankod/refine-simple-rest": "^3.18.0",
"@sentry/react": "^7.42.0",
"@sentry/tracing": "^7.42.0",
"@testing-library/jest-dom": "^5.12.0",
"@testing-library/react": "^11.2.6",
"@testing-library/user-event": "^12.8.3",
"@types/jest": "^26.0.23",
"child_process": "^1.0.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"web-vitals": "^1.1.1"
},
"devDependencies": {
"@sentry/cli": "^2.14.4",
"@types/node": "^18.15.3",
"@types/react": "^18.0.15",
"@types/react-dom": "^18.0.6",
"@vitejs/plugin-react": "^3.1.0",
"typescript": "^4.7.4",
"vite": "^4.1.1"
},
"scripts": {
"start": "vite",
"build": "tsc && vite build",
"preview": "vite preview",
"refine": "refine"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
which package are you referring to ? 😅 i am assuming, I should move
"@types/node": "^18.15.3",
"@types/react": "^18.0.15",
"@types/react-dom": "^18.0.6",
"@types/node": "^18.15.3",
"@types/react": "^18.0.15",
"@types/react-dom": "^18.0.6",
from dev to main dependency ?
Omer
Omer2y ago
Hey @haribo_mushi , Could you share a reproducible demo? CodeSanbox, StackBlitz, etc.
Omer
Omer2y ago
Also, refine v4 was released yesterday. If you haven't reviewed it yet, https://refine.dev/blog/refine-v4-announcement/ 💯
Announcing the Release of refine v4! | refine
This release includes several new features that are designed to enhance the developer experience.
stormy-gold
stormy-goldOP2y ago
yup, I am planning to migrate once I am done with current development 😅 I am kind of unsure about how to reproduce this ? I am able to run it on my local dev server but once I run vite build using npm run build and check the preview of it, it gives me the above mentioned error
Omer
Omer2y ago
hmm have you tried our Vite example? Unfortunately we can't help if you can't provide an environment where we can reproduce 😦 https://github.com/refinedev/refine/tree/next/examples/with-vite
stormy-gold
stormy-goldOP2y ago
i understand, sure I will try to set it up on stackblitz later, once done will share it here
Omer
Omer2y ago
Thank you very much for your understanding and patience 🍻
stormy-gold
stormy-goldOP2y ago
i resolved it realised my .env file wasnt loading up in a production build had to add loadEnv to load my env. Now the build preview is working fine
export default defineConfig(({ mode }) => {

const env = loadEnv(mode, process.cwd())
export default defineConfig(({ mode }) => {

const env = loadEnv(mode, process.cwd())
Omer
Omer2y ago
hooray 🥳