Issue on Next 12 - CommonJS script issue
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- JavaScript
- Star
- 46
- Fork
- 8
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
Hello
I recently updated a project of mine to Next 12 and then also updated the `converkit-react` library to `1.5.5`.
When I startup the project and load my page with the form on it I now get the following error.
```
error - unhandledRejection: ReferenceError: require is not defined in ES module scope, you can use import instead
This file is being treated as an ES module because it has a '.js' file extension and '/workspaces/project/node_modules/convertkit-react/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
```
I do not think I am going anything special. This is a vanilla next project and I import the form with the following.
```
import ConvertKitForm from 'convertkit-react';
```
I am not sure what might be going wrong here but I see in the project history there was a release specifically for Next around commonjs a few releases back.
Maybe something has changed with Next 12?
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Tái hiện lỗi trong một dự án Next 12 vanilla bằng import ConvertKitForm được cung cấp, sau đó kiểm tra convertkit-react/package.json và entry của module được import đó chọn. Được xem là hoàn tất khi form tải mà không có lỗi require của ES-module/CommonJS, đồng thời vẫn duy trì khả năng tương thích của thư viện với Next.js.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript, nextjs, react
- Lĩnh vực
- frontend
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 25/100