nfroidure/gulp-iconfont

RangeError: Array buffer allocation failed

Closed this issue · 2 comments

We are getting this error, despite the fact we're not using ttf2woff2 format.

 at new ArrayBuffer (<anonymous>)
    at Object.<anonymous> (D:\home\site\wwwroot\public\collection\node_modules\ttf2woff2\jssrc\ttf2woff2.js:1:23296)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
    at Module.require (module.js:568:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (D:\home\site\wwwroot\public\collection\node_modules\ttf2woff2\jssrc\index.js:3:27)

It seems like a known issue in ttf2woff2:
nfroidure/ttf2woff2#38

If we could move the require to be more lazy then it can provide a nice work around the issue.

const duplexer = require('plexer');
const svgicons2svgfont = require('gulp-svgicons2svgfont');
const svg2ttf = require('gulp-svg2ttf');
const ttf2eot = require('gulp-ttf2eot');
const ttf2woff = require('gulp-ttf2woff');
const ttf2woff2 = require('gulp-ttf2woff2');

to:

// Generating WOFF2 font
    .pipe(cond(
      -1 !== options.formats.indexOf('woff2'),
      () =>  require('gulp-ttf2woff2')({ clone: true }).on('error', (err) => {
        outStream.emit('error', err);
      })
    ))

If it solves your problem and does not break anything, feel free to PR, I'll merge it.

Was fixed by #159.