• /
  • EnglishEspañol日本語한국어Português
  • Log inStart now

Rollup unresolved imports

Problem

You receive an UNRESOLVED_IMPORT error while building your project using the browser agent NPM package in a project that uses rollup for bundling.

Solution

Update your rollup configuration to use the node-resolve plugin. If you already use this plugin, update the plugin to a minimum version of 15.2.1.

Stencil Projects

If your project uses the stencil framework, you won't be able to override the node-resolve plugin version. Use the workaround listed below in your project and monitor this issue in the stencil github repository.

Alternative workaround

If you can't update the node-resolve plugin or you're using a framework that bundles the plugin that you can't override, you'll need to change your browser agent import statement.

// Instead of importing the browser agent like this
import { MicroAgent } from "@newrelic/browser-agent/loaders/micro-agent";
// Import like this
import { MicroAgent } from "@newrelic/browser-agent/src/loaders/micro-agent";

The src directory contains our ES2019+ code. If you can't apply transpilation to this code and need to support older browsers, upgrade the browser agent NPM package to version 1.252.0 and use the below import statement:

import { MicroAgent } from "@newrelic/browser-agent/dist/esm/loaders/micro-agent";

The contents of the dist directory follow our browser support statement.

Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.