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

After upgrading from 1.2.2 to 1.3.1, I end up getting an invalid typed array length error #13

Open
kelly-tock opened this issue Jan 2, 2020 · 2 comments

Comments

@kelly-tock
Copy link

Uncaught (in promise) RangeError: Invalid typed array length: 2687565824
    at new Uint8Array (<anonymous>)
    at new UnicodeTrie (index.js?ed47:87)
    at Object.eval (index.js?4b72:6872)
    at eval (index.js:14940)
    at Object../node_modules/fontkit/index.js (8.index.js:1375)
    at __webpack_require__ (index.js:770)
    at fn (index.js:130)
    at Object.eval (pdfkit.js?20a6:7)
    at eval (pdfkit.js:5583)
    at Object../node_modules/pdfkit/js/pdfkit.js (8.index.js:1643)
   "pdfkit": "0.11.0",
   "blob-stream": "^0.1.3",

webpack config:

{ enforce: 'post', test: /pdfkit[/\\]js\/pdfkit.js$/, loader: 'transform-loader?brfs' },
    { enforce: 'post', test: /fontkit[/\\]index.js$/, loader: 'transform-loader?brfs' },
    { enforce: 'post', test: /png-js[/\\]index.js$/, loader: 'transform-loader?brfs' },
    { enforce: 'post', test: /brotli[/\\]index.js$/, loader: 'transform-loader?brfs' },
    { enforce: 'post', test: /unicode-properties[/\\]index.js$/, loader: 'transform-loader?brfs' },
    {
      enforce: 'post',
      test: /linebreak[/\\]src[/\\]linebreaker.js/,
      loader: 'transform-loader?brfs',
    },

dynamically importing pdf kit and blob stream:

    import('pdfkit/js/pdfkit.js' as any).then((pdfkit) => {
      PDFDocument = pdfkit.default;
    });
    import('blob-stream').then((blobstream) => {
      blobStream = blobstream.default;
    });
@jeremysf
Copy link

Same.

@PerBothner
Copy link

My semi-fork/rewrite has a re-written "generate" (loosely based on grapheme-breaker-mjs) that is more efficient and robust. It handles Unicode 13 in a fraction of a second. It only supports the properties I need (for the DomTerm terminal emulator) but it should be straight-forward to extend it for more properties.

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

3 participants