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

Warning when running with Angular + Vite

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

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
55/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
angular, typescript, vite
Lĩnh vực
build-system, frontend

Hướng nghiên cứu

Bắt đầu với phần thiết lập Angular trong main.ts sử dụng defineCustomElements và tái hiện cảnh báo bằng ng serve trong một dự án Angular 17 mới. So sánh giải pháp khắc phục cấu hình Vite từ issue 109 với hành vi của package pwa-elements; được xem là hoàn tất khi package hoạt động offline mà không tạo ra cảnh báo import động.

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

Mô tả

Running a fresh Angular 17 project, which uses Vite, and latest Capacitor.
Added pwa-elements as described in the Capacitor docs https://capacitorjs.com/docs/web/pwa-elements#angular:
main.ts:

import { defineCustomElements } from '@ionic/pwa-elements/loader';
defineCustomElements(window);

Running the code (ng serve) results in this warning: "The above dynamic import cannot be analyzed by Vite".
image

Notably, everything does still seem to function, but the warning is a nuisance.

Hard to say if the issue is more with the stencil version that builds pwa-elements or what.

Workarounds
Changing the vite config as described here https://github.com/ionic-team/pwa-elements/issues/109#issuecomment-1405061645 might potentially work, except Angular doesn't currently support configuring vite (https://angular.io/guide/esbuild#:~:text=currently%20cannot%20be%20directly%20configured).

Instead including pwa-elements via a cdn script tag in index.html does remove the warning, but doesn't work for offline scenarios.

Ngôn ngữ chính
TypeScript
Star
172
Fork
50
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 ionic-team/pwa-elements

Tất cả issue của ionic-team/pwa-elements

Issue tương tự

Thêm issue về TypeScript

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.