All our outputted component files contain a hardcoded definition of the package.json properties, because they directly import { version } from 'package.json', which is inlined by the compiler.
We could reduce the size of all of our components by converting the json to a js module first (for example as a utility). So the json data is only stored in within this module and can be used in all the components by importing it.
// src/utils/package.ts
import * as packageJson from '../../package.json';
export const pkg = packageJson;
All our outputted component files contain a hardcoded definition of the package.json properties, because they directly import
{ version } from 'package.json'
, which is inlined by the compiler.We could reduce the size of all of our components by converting the json to a js module first (for example as a utility). So the json data is only stored in within this module and can be used in all the components by importing it.