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

🐛[BUG] 在remix中使用出现的问题 #179

Open
PeiJM opened this issue Apr 24, 2024 · 0 comments
Open

🐛[BUG] 在remix中使用出现的问题 #179

PeiJM opened this issue Apr 24, 2024 · 0 comments
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@PeiJM
Copy link

PeiJM commented Apr 24, 2024

🐛 bug 描述

报错
(node:29488) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use node --trace-warnings ... to show where the warning was created)
16:43:37 [vite] Error when evaluating SSR module /app/routes/_index.tsx: failed to import "@ant-design/pro-chat"
|- D:\Project\gsxm\remix-test\node_modules@ant-design\pro-chat\es\index.js:1
export { default as ActionIcon } from "./ActionIcon";
^^^^^^

SyntaxError: Unexpected token 'export'
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1178:20)
at Module._compile (node:internal/modules/cjs/loader:1220:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at ModuleWrap. (node:internal/modules/esm/translators:169:29)
at ModuleJob.run (node:internal/modules/esm/module_job:194:25)

16:43:37 [vite] Error when evaluating SSR module virtual:remix/server-build: failed to import "/app/routes/_index.tsx"
|- D:\Project\gsxm\remix-test\node_modules@ant-design\pro-chat\es\index.js:1
export { default as ActionIcon } from "./ActionIcon";
^^^^^^

SyntaxError: Unexpected token 'export'
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1178:20)
at Module._compile (node:internal/modules/cjs/loader:1220:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at ModuleWrap. (node:internal/modules/esm/translators:169:29)
at ModuleJob.run (node:internal/modules/esm/module_job:194:25)

16:43:37 [vite] Internal server error: Unexpected token 'export'
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1178:20)
at Module._compile (node:internal/modules/cjs/loader:1220:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at ModuleWrap. (node:internal/modules/esm/translators:169:29)
at ModuleJob.run (node:internal/modules/esm/module_job:194:25)
16:43:38 [vite] hmr update /app/routes/_index.tsx, /app/routes/_index.tsx?client-route=1
16:43:38 [vite] Error when evaluating SSR module /app/routes/_index.tsx: failed to import "@ant-design/pro-chat"
|- D:\Project\gsxm\remix-test\node_modules@ant-design\pro-chat\es\index.js:1
export { default as ActionIcon } from "./ActionIcon";
^^^^^^

SyntaxError: Unexpected token 'export'
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1178:20)
at Module._compile (node:internal/modules/cjs/loader:1220:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at ModuleWrap. (node:internal/modules/esm/translators:169:29)
at ModuleJob.run (node:internal/modules/esm/module_job:194:25)

16:43:38 [vite] Error when evaluating SSR module virtual:remix/server-build: failed to import "/app/routes/_index.tsx"
|- D:\Project\gsxm\remix-test\node_modules@ant-design\pro-chat\es\index.js:1
export { default as ActionIcon } from "./ActionIcon";
^^^^^^

SyntaxError: Unexpected token 'export'
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1178:20)
at Module._compile (node:internal/modules/cjs/loader:1220:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at ModuleWrap. (node:internal/modules/esm/translators:169:29)
at ModuleJob.run (node:internal/modules/esm/module_job:194:25)

16:43:38 [vite] Internal server error: Unexpected token 'export'
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1178:20)
at Module._compile (node:internal/modules/cjs/loader:1220:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at ModuleWrap. (node:internal/modules/esm/translators:169:29)
at ModuleJob.run (node:internal/modules/esm/module_job:194:25)

📷 复现步骤

npx create-remix@latest 创建remix项目
$ npm install antd antd-style -S
$ npm install @ant-design/pro-chat -S
正常安装引入后 run dev 会报错

© 版本信息

"@ant-design/pro-chat": "^1.13.1",
"@remix-run/node": "^2.8.1",
"@remix-run/react": "^2.8.1",
"@remix-run/serve": "^2.8.1",
"antd": "^5.16.4",
"antd-style": "^3.6.2",
"isbot": "^4.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"

🚑 其他信息

image

@ONLY-yours ONLY-yours added bug Something isn't working documentation Improvements or additions to documentation labels Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants