Sometimes, it may be useful to import a file in your code because of the side effects it will cause. For example, you might import a file that defines a set of global variables, but never explicitly use the imported file in your code. You would still have access to the global variables the package has declared.
You can import files with side effects in instrumentation.ts, which you might want to use in your register function as demonstrated in the following example:
your-project/instrumentation.ts import { init } from 'package-init'
 
export function register() {
  init()
}
However, we recommend importing files with side effects using import from within your register function instead. The following example demonstrates a basic usage of import in a register function:
your-project/instrumentation.ts export async function register() {
  await import('package-with-side-effect')
}