I have a small package that has this code.
import fs from 'fs'
import opentype from "opentype.js"
/**
* Load the font description from the given file path.
* @param {String} path - path to local file, i.e. font
* @returns {Font} new font object which contains the contents of the font
*/
export const loadFont = (path) => {
return opentype.parse(fs.readFileSync(path))
}
/**
* Load the font description from the given data.
* @param {ArrayBuffer} data - raw data from font file
* @returns {Font} new font object which contains the contents of the font
*/
export const loadFontFromData = (data) => {
return opentype.parse(data)
}
However, when I try to rollup the package into a combined distribution, rollup say...
npm run build
> jscad-text@4.0.0 build
> rollup --config
./src/index.js → ./dist/jscad-text.umd.js, ./dist/jscad-text.js...
[!] RollupError: src/loadFont.js (3:7): "default" is not exported by "node_modules/opentype.js/dist/opentype.mjs", imported by "src/loadFont.js".
https://rollupjs.org/troubleshooting/#error-name-is-not-exported-by-module
src/loadFont.js (3:7)
This seems to be an issue with the packaging.
I have a small package that has this code.
However, when I try to rollup the package into a combined distribution, rollup say...
This seems to be an issue with the packaging.