bug: UNRESOLVED_IMPORT when trying to import newrelic browser agent

オープン
#5,286 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
node.js, typescript
領域
build-system

調査の方向性

src/components/my-component/my-component.tsx から @newrelic/browser-agent/loaders/micro-agent の import を使用して再現し、その後 yarn build または npm run build を実行して UNRESOLVED_IMPORT 警告を調査します。さらに yarn start または npm start でアプリを実行します。プロジェクトがビルドされ、ブラウザーエージェントの import が未解決のモジュール指定子エラーなしで読み込まれれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Bug: Validated Has Workaround
Prerequisites
Stencil Version

4.7.0

Current Behavior

When importing the @newrelic/browser-agent module to a Stencil project, the bundler does not seem to know how to bundle newrelic. I get an UNRESOLVED_IMPORT message. Other imports to stencil appear to work properly and only newrelic's browser agent seems to have an issue.

Expected Behavior

The project builds properly with the newrelic import and, when started, properly tries to load the newrelic agent (it's not configured in this example, but I should see it try).

System Info
System: node 20.11.0
    Platform: windows (10.0.23615)
   CPU Model: AMD Ryzen 7 3700X 8-Core Processor              (16 cpus)
    Compiler: C:\Work\test-newrelic\node_modules\@stencil\core\compiler\stencil.js
       Build: 1705946070
     Stencil: 4.11.0
  TypeScript: 5.3.3
      Rollup: 2.56.3
      Parse5: 7.1.2
      jQuery: 4.0.0-pre
      Terser: 5.27.0
Steps to Reproduce

(Attached a code sample or just create a new Stencil project following the Getting Started docs for it and import the browser agent)
test-newrelic.zip

After unzipping the code sample, run:

  • yarn (or npm i) to install dependencies
  • yarn build or (npm run build) to build the app.

When building, you will see:

[ WARN  ]  Bundling Warning UNRESOLVED_IMPORT
           '@newrelic/browser-agent/loaders/micro-agent' is imported by src\components\my-component\my-component.tsx,
           but could not be resolved – treating it as an external dependency

Additionally, you can start the app with yarn start or npm start. If you start it and load the URL of the page, you will see:

TypeError: Failed to resolve module specifier "@newrelic/browser-agent/loaders/micro-agent". Relative references must start with either "/", "./", or "../".
Code Reproduction URL

https://github.com/OuranosSkia/test-newrelic

Additional Information

No response

主要言語
TypeScript
スター
13.2k
フォーク
865
平均マージ
2日 16時間
マージ済み PR(30日)
29

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

stenciljs/core のほかの issue

stenciljs/core の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。