How to use async function?

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

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

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
javascript
Lĩnh vực
tooling

Hướng nghiên cứu

Start by reproducing the async processPostCSS example and capture the error from postcssrc(ctx), since no file or test is identified in the issue. Done means determining why the async API fails and documenting or fixing the behavior so the example returns css successfully.

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

Mô tả

I've never been able to successfully use the async API in my application and I'm wondering why? Do you have any thoughts?

I'm using:

async function processPostCSS(src = '') {
	const ctx = { parser: true, map: 'inline' };

	const { plugins } = await postcssrc(ctx)
	const { css } = await postcss([postcssNested(), autoprefixer(), ...plugins]).process(src, { from: undefined })

	return css
}

postcssrc(ctx) causes this function to break for some reason that I don't understand. If I change to the synchronous API it works fine. I'm not sure how to tell what the error is, all I know is that it doesn't return the css when I use the postcss-load-config async API

What am I doing incorrectly?

Ngôn ngữ chính
JavaScript
Star
661
Fork
76
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

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 postcss/postcss-load-config

Tất cả issue của postcss/postcss-load-config

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.