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

https://edu.duthanhduoc.com/learn/Next.Js-Super?lessonId=594 #70

Open
utterances-bot opened this issue Oct 24, 2024 · 2 comments
Open

Comments

@utterances-bot
Copy link

Khu vực học tập | Được Edu

Được chỉ cung cấp các khóa học lập trình online chất lượng, nói không với khóa lởm!

https://edu.duthanhduoc.com/learn/Next.Js-Super?lessonId=594

Copy link

(node:79952) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ... to show where the warning was created)
Failed to compile.

./src/lib/utils.ts
Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime
Learn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation

The error was caused by importing 'socket.io-client/build/esm/index.js' in './src/lib/utils.ts'.

Import trace for requested module:
./src/lib/utils.ts
./src/middleware.ts

Build failed because of webpack errors

e bị lỗi này khi build, e fix hoài ko đc.

@duthanhduoc
Copy link
Contributor

(node:79952) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead. (Use node --trace-deprecation ... to show where the warning was created) Failed to compile.

./src/lib/utils.ts Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime Learn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation

The error was caused by importing 'socket.io-client/build/esm/index.js' in './src/lib/utils.ts'.

Import trace for requested module: ./src/lib/utils.ts ./src/middleware.ts

Build failed because of webpack errors

e bị lỗi này khi build, e fix hoài ko đc.

Do cái file util đó vừa dùng ở client, vừa dùng ở server next. Nên khi build socket.io client nó được dùng ở server nên lỗi.

Tạo cái file client-utils.ts rồi đưa cái socket.io vào

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

3 participants