As of version 3.4.0, the @microsoft/applicationinsights-common package has been merged into
@microsoft/applicationinsights-core-js. This consolidation simplifies the dependency tree
and improves tree-shaking capabilities while maintaining full backward compatibility.
- All functionality from
applicationinsights-commonis now exported fromapplicationinsights-core-js - The
applicationinsights-commonpackage still exists as a compatibility layer (re-exports from Core) - No breaking changes to public APIs
- All imports work the same, just from a different package
In your package.json:
{
"dependencies": {
// Before
"@microsoft/applicationinsights-common": "3.3.11",
"@microsoft/applicationinsights-core-js": "3.3.11"
// After
"@microsoft/applicationinsights-core-js": "3.4.0"
// Remove applicationinsights-common dependency
}
}Find and replace in your source files:
// Before
import { IConfig, ContextTagKeys, Event } from "@microsoft/applicationinsights-common";
// After
import { IConfig, ContextTagKeys, Event } from "@microsoft/applicationinsights-core-js";You can use a script to automate the migration:
# Replace imports in TypeScript files
find ./src -name "*.ts" -exec sed -i 's/@microsoft\/applicationinsights-common/@microsoft\/applicationinsights-core-js/g' {} +
# Update package.json manually or with jqNo. The applicationinsights-common package will continue to work through version 3.x as a
compatibility layer. However, we recommend migrating when convenient as:
- The Common package will be removed in version 4.0.0
- Direct Core imports result in smaller bundles (better tree-shaking)
- Future features will only be added to Core
- Version 3.4.0 (Current): Common merged into Core, compatibility layer introduced
- Version 3.x (Ongoing): Both import styles supported
- Version 4.0.0 (Future): Common package removed, Core imports required
The compatibility layer ensures your code continues to work without changes. However:
- Your bundle may be slightly larger (includes the re-export layer)
- You may see deprecation warnings in development
- You'll need to migrate before upgrading to version 4.0.0
If you encounter type errors after migration:
- Ensure
@microsoft/applicationinsights-core-jsis version 3.4.0 or higher - Remove
@microsoft/applicationinsights-commonfrom dependencies - Clear
node_modulesand reinstall:rm -rf node_modules && npm install - Restart TypeScript server in your IDE
If an import can't be found:
- Verify the export exists in Core 3.4.0+
- Check for typos in import names
- Ensure you're importing from
@microsoft/applicationinsights-core-js
If your bundle size increased after migration:
- Ensure you're using
@microsoft/applicationinsights-core-js3.4.0+ - Remove
@microsoft/applicationinsights-commonfrom package.json - Rebuild with tree-shaking enabled
- Check for unused imports and remove them