foliojs / fontkit

An advanced font engine for Node and the browser
1.45k stars 213 forks source link

Unable to import fontkit's package.json in dependent packages #287

Open fstrube opened 2 years ago

fstrube commented 2 years ago

Packages that depend on fontkit are no longer able to obtain version information and other metadata by importing fontkit's package.json. Previously, we were able to do something like this:

const fontkitVersion = require('fontkit/package.json').version;

// or

import fontkitPackage from 'fontkit/package.json' assert {type: 'json'};

const fontkitVersion = fontkitPackage.version;

Now, we receive an ERR_PACKAGE_PATH_NOT_EXPORTED error when attempting to import the package.json file.

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports"