bug: UNRESOLVED_IMPORT when trying to import newrelic browser agent

Abierto
#5,286 5 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
node.js, typescript
Área
build-system

Línea de trabajo

Reproduce desde src/components/my-component/my-component.tsx usando el import @newrelic/browser-agent/loaders/micro-agent; después ejecuta yarn build o npm run build e inspecciona la advertencia UNRESOLVED_IMPORT. Ejecuta también la aplicación con yarn start o npm start; se considera terminado cuando el proyecto se compila y el import del agente del navegador se carga sin el error de especificador de módulo no resuelto.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
TypeScript
Estrellas
13.2k
Forks
865
Merge medio
2 d 16 h
PR fusionados (30 d)
29

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de stenciljs/core

Todos los issues de stenciljs/core

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.