Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Source maps not working with standard input

Đang mở
#178 3 bình luận 3 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 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ệ
javascript, node.js
Lĩnh vực
devtools

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện vấn đề với node dist/bundle.js và cat dist/bundle.js | node, đồng thời so sánh các stack trace source-mapped và [stdin] được hiển thị ở đây. Theo dõi cách source-map-support xử lý các script được cung cấp qua đầu vào chuẩn. Công việc được coi là hoàn tất khi lệnh gọi qua đầu vào chuẩn báo cáo vị trí mã nguồn ban đầu và thông tin dòng, với một bài kiểm thử hồi quy bao quát cả hai lệnh.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Below is the source file I am using:

require('source-map-support').install();
throw new Error('error on line two');

The following command will generate the correct output:

node dist/bundle.js

output:

/Users/nick/Desktop/dist/webpack:/example/index.js:2
throw new Error('error on line two');
^
Error: error on line two
    at Object.<anonymous> (/Users/nick/Desktop/dist/webpack:/example/index.js:2:1)
    at __webpack_require__ (/Users/nick/Desktop/dist/webpack:/webpack/bootstrap 8d9d0b53441c2ea13b08:19:1)
    at /Users/nick/Desktop/dist/webpack:/webpack/bootstrap 8d9d0b53441c2ea13b08:39:1
    at Object.<anonymous> (/Users/nick/Desktop/dist/bundle.js:43:10)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)

The following command with not generate a line number or other source map information:

cat dist/bundle.js | node

output:

Error: error on line two
    at Object.<anonymous> ([stdin]:48:8)
    at __webpack_require__ ([stdin]:20:30)
    at [stdin]:40:18
    at [stdin]:43:10
    at ContextifyScript.Script.runInThisContext (vm.js:23:33)
    at Object.exports.runInThisContext (vm.js:74:17)
    at Object.<anonymous> ([stdin]-wrapper:6:22)
    at Module._compile (module.js:571:32)
    at Immediate.<anonymous> (bootstrap_node.js:387:29)
    at runCallback (timers.js:651:20)

The issue seems to arise when passing a script via standard input to node. I originally discovered it when I was creating a child process in node and passing generated code to it.

Please let me know if any more information is needed.

Thank you for your time in supporting this awesome project, and for taking the time to help me.

Ngôn ngữ chính
JavaScript
Star
2.2k
Fork
221
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của evanw/node-source-map-support

Tất cả issue của evanw/node-source-map-support

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.