Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.9.0 在 Node 中无法使用 #26

Closed
richex-cn opened this issue Oct 24, 2023 · 3 comments
Closed

4.9.0 在 Node 中无法使用 #26

richex-cn opened this issue Oct 24, 2023 · 3 comments

Comments

@richex-cn
Copy link
Contributor

https://codesandbox.io/p/sandbox/nodejs-cn-font-split-46jdgr?file=%2Findex.js%3A9%2C1

➜  workspace git:(master) ✗ node index.js
INFO    -->             LoadFile        Start
INFO    cn-font-split 环境检测   node
TRACE   输入文件大小:2.1 MB
INFO    <--     24ms    LoadFile        Done
INFO    -->             transferFontType        Start
INFO    <--     0ms     transferFontType        Done
INFO    -->             loadHarbuzz     Start
INFO    <--     17ms    loadHarbuzz     Done
INFO    -->             initOpentype    Start
file:///workspaces/workspace/node_modules/@konghayao/opentype.js/dist/opentype.js:13525
(function (root, factory) { if (typeof define === 'function' && define.amd)define(factory); else if (typeof module === 'object' && module.exports)module.exports = factory(); else root.opentype = factory(); }(typeof self !== 'undefined' ? self : this, () => ({...opentype,'default':opentype})));
                                                                                                                                                                                                 ^

TypeError: Cannot set properties of undefined (setting 'opentype')
    at file:///workspaces/workspace/node_modules/@konghayao/opentype.js/dist/opentype.js:13525:194
    at file:///workspaces/workspace/node_modules/@konghayao/opentype.js/dist/opentype.js:13525:208
    at ModuleJob.run (node:internal/modules/esm/module_job:192:25)
    at async DefaultModuleLoader.import (node:internal/modules/esm/loader:228:24)
    at async initOpentype (file:///workspaces/workspace/node_modules/@konghayao/cn-font-split/dist/index.js:1536:9)
    at async Executor.nextStep (file:///workspaces/workspace/node_modules/@konghayao/cn-font-split/dist/index.js:696:7)
    at async Executor.run (file:///workspaces/workspace/node_modules/@konghayao/cn-font-split/dist/index.js:721:14)
    at async fontSplit (file:///workspaces/workspace/node_modules/@konghayao/cn-font-split/dist/index.js:1667:3)

Node.js v20.5.1

是忽略了什么吗?

@KonghaYao
Copy link
Owner

@konghayao/opentype.js 这个依赖在 2023.10.26 版本后会有不兼容的问题,故你可以这样锁定版本

 "@konghayao/cn-font-split": "4.9.0",
 "@konghayao/opentype.js":"2023.10.5"

@KonghaYao
Copy link
Owner

今晚会上一个紧急修复版本 4.9.2

@KonghaYao
Copy link
Owner

4.9.2 已经上线,修复了这个问题

 "@konghayao/cn-font-split": "^4.9.2"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants