Skip to content

Named export of version field from package.json causes errors in Angular build #535

@nickiannone-fis

Description

@nickiannone-fis

Node version: v24.15.0
NPM version: v11.12.1

import { version } from '../../package.json';

I'm having an issue with the above line in my Angular application builds which use the Thoughtspot Visual Embed SDK; apparently this method of directly referencing the version number from package.json is no longer allowed in modern Angular builds:

✔ Browser application bundle generation complete.

36 unchanged chunks
Build at: 2026-05-20T20:13:10.626Z - Hash: 1a7724cd1a4fb955 - Time: 509ms
./node_modules/@thoughtspot/visual-embed-sdk/lib/src/embed/ts-embed.js:602:33-40 - Error: Should not import the named export 'version' (imported as 'version') from default-exporting module (only default export is available soon)
./node_modules/@thoughtspot/visual-embed-sdk/lib/src/mixpanel-service.js:80:20-27 - Error: Should not import the named export 'version' (imported as 'version') from default-exporting module (only default export is available soon)

✖ Failed to compile.

There's a proposed solution here: https://stackoverflow.com/a/67216720/32568163

// ts-embed.ts
// Swap the field import for a default import
// import { version } from '../../package.json';
import { default as packageInfo } from '../../package.json';

// Swap the single usage in getBaseQueryParams():
//        queryParams[Param.Version] = version;
          queryParams[Param.Version] = packageInfo.version;
// mixpanel-service.ts
// Swap the field import for a default import
// import { version } from '../../package.json';
import { default as packageInfo } from '../../package.json';

// Swap the single usage in initMixpanel():
//                sdkVersion: version,
                  sdkVersion: packageInfo.version,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions