ESM bundling awareness (prerequisite)
In OneCX v8, @onecx/accelerator and @onecx/integration-interface are published as ES modules.
For standard Angular application builds, this is usually non-breaking. This page helps you quickly detect and fix issues in custom runtime/build setups.
What changed
-
Packages are ESM (
"type": "module"). -
CommonJS-only usage patterns (for example
require()in custom Node scripts) may need adaptation.
When to check this
Check this prerequisite if your project includes custom scripts/tooling such as:
-
Node scripts importing OneCX packages directly
-
Custom webpack/rspack wrappers around MF runtime loading
-
Test/dev scripts running outside Angular CLI/Nx standard build flow
Typical issues you might face
-
ERR_REQUIRE_ESM -
require is not defined in ES module scope -
Module resolution/import errors in custom scripts after dependency update
Solutions
1) Replace require() with ESM imports
const { EventsTopic } = require('@onecx/integration-interface')
import { EventsTopic } from '@onecx/integration-interface'