Error: Unexpected token when including a file with `declare namespace` in it.
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- babel, javascript, typescript
- Lĩnh vực
- build-system, tooling
Hướng nghiên cứu
Tái hiện lệnh được báo cáo, microbundle --jsx React.createElement --tsconfig tsconfig.build.json, bằng cách sử dụng tệp OpenSeadragonV5.d.ts được tham chiếu. Trước tiên, hãy kiểm tra tsconfig.build.json và .babelrc.json để xem các tệp khai báo và declare namespace được phân tích như thế nào. Được xem là hoàn thành khi package build thành công mà không có lỗi cú pháp Babel hoặc lỗi token không mong đợi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hi microbundle team.
I'm trying to build a package, and I've needed to override some types since the types repo for the main dependency hasn't been updated.
I was on 0.14.x before, but I updated to 0.15.1 and I still get this error.
$ microbundle --jsx React.createElement --tsconfig tsconfig.build.json
Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
at /Users/user/Documents/osd-react-renderer/packages/renderer/src/types/OpenSeadragonV5.d.ts:3:8
1: /* eslint-disable max-classes-per-file */
2:
3: declare namespace OpenSeadragon {
^
4: export function isFunction(obj: unknown): boolean;
I actually had two errors in this file. The first error said:
osd-react-renderer: (babel plugin) SyntaxError: /Users/user/Documents/osd-react-renderer/packages/renderer/src/types/OpenSeadragonV5.d.ts: Missing semicolon. (3:7)
osd-react-renderer: 1 | /* eslint-disable max-classes-per-file */
osd-react-renderer: 2 |
osd-react-renderer: > 3 | declare namespace OpenSeadragon {
osd-react-renderer: | ^
osd-react-renderer: 4 | export function isFunction(obj: unknown): boolean;
osd-react-renderer: 5 |
osd-react-renderer: 6 | export function isCanvasTainted(canvas: HTMLCanvasElement): boolean;
osd-react-renderer: at undefined:3:7
This error I was able to resolve with a .babelrc.json file, but I can't see what configuration can be used to resolve the first error.
I noticed that previously we were able to build the app when we used declare module OpenSeadragonV2, but declare namespace` specifically is causing this.
Any suggestions on what configuration can resolve this issue?
Thanks
- Ngôn ngữ chính
- JavaScript
- Star
- 8.1k
- Fork
- 358
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
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.
Issue khác của developit/microbundle
-
CSS
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
developit/microbundle#1002 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
developit/microbundle#789 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
developit/microbundle#1100 · 4 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
developit/microbundle#1094 · 1 bình luận ·
-
Disable minification by default Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
developit/microbundle#1093 · 3 bình luận · 1 reaction ·
Tất cả issue của developit/microbundle
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Theme loads third-party resources on every page (jsdelivr web font, cdnjs Font Awesome) – GDPR Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
docToolchain/docToolchain#1705 ·
-
Timezone select lists one option per character; duplicate "Failed" reason; shared tracker popover id Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
nightscout/nocturne#1414 ·
-
bug v2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
modelcontextprotocol/inspector#2458 · 1 bình luận ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
carbon-design-system/ibm-products#9907 ·