Skip to content

Export issues? #836

Description

@z3dev

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions