Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: change dynamic import to work with bundlers #1905

Merged
merged 2 commits into from Dec 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions index.js
Expand Up @@ -40,7 +40,7 @@ if (require.cache.__NR_cache) {
}

function initApi({ agent, apiPath }) {
const API = require(apiPath)
const API = require(`./${apiPath}`)

const api = new API(agent)
require.cache.__NR_cache = module.exports = api
Expand Down Expand Up @@ -115,7 +115,7 @@ function initialize() {
/* eslint-enable no-console */
}

const api = agent ? initApi({ agent, apiPath: './api' }) : initApi({ apiPath: './stub_api' })
const api = agent ? initApi({ agent, apiPath: 'api' }) : initApi({ apiPath: 'stub_api' })

// If we loaded an agent, record a startup time for the agent.
// NOTE: Metrics are recorded in seconds, so divide the value by 1000.
Expand Down