vendredi 17 juin 2016

Trying to import pdf.worker.js of PDFJS using brocfile

I am trying to import pdfJS's pdf.worker.js to an assets folder, so that I can mark the location pdf.worker.js remains static and I can use it to reference PDFJS.workerSrc property.

my brocfile setup for PDFJS is as below

app.import('bower_components/pdfjs-dist/build/pdf.js');
app.import('bower_components/pdfjs-dist/build/pdf.worker.js', { destDir: '/assets' });
app.import('bower_components/pdfjs-dist/web/pdf_viewer.js');

but when I do the ember build --environment=production, I am getting the following error

version: 0.1.2
Build failed.
File: assets/vendor.js
Maximum call stack size exceeded
RangeError: Maximum call stack size exceeded
    at RegExp.test (native)
    at is_unicode_combining_mark (~/frontend/node_modules/ember-cli/node_modules/broccoli-uglify-js/node_modules/uglify-js/lib/parse.js:144:37)
    at is_identifier_char (~/frontend/node_modules/ember-cli/node_modules/broccoli-uglify-js/node_modules/uglify-js/lib/parse.js:165:12)
    at read_name (~/frontend/node_modules/ember-cli/node_modules/broccoli-uglify-js/node_modules/uglify-js/lib/parse.js:423:26)
    at read_word (~/frontend/node_modules/ember-cli/node_modules/broccoli-uglify-js/node_modules/uglify-js/lib/parse.js:498:20)
    at Object.next_token [as input] (~/frontend/node_modules/ember-cli/node_modules/broccoli-uglify-js/node_modules/uglify-js/lib/parse.js:543:61)
    at next (~/frontend/node_modules/ember-cli/node_modules/broccoli-uglify-js/node_modules/uglify-js/lib/parse.js:642:25)
    at subscripts (~/frontend/node_modules/ember-cli/node_modules/broccoli-uglify-js/node_modules/uglify-js/lib/parse.js:1286:13)
    at expr_atom (~/frontend/node_modules/ember-cli/node_modules/broccoli-uglify-js/node_modules/uglify-js/lib/parse.js:1164:20)
    at maybe_unary (~/frontend/node_modules/ember-cli/node_modules/broccoli-uglify-js/node_modules/uglify-js/lib/parse.js:1327:19)

I tried surfing the issue, and came to understand that uglify has issues with big files. When checked the size of pdf.worker.js found out that it has the size of 1.4 MB. But still I want to use Brocfile to push the file to asset. Is there any way to do this.

NOTE: I am using very old ember version i.e. 1.7.1 and due to certains reasons I cannot upgrade ember version yet.




Aucun commentaire:

Enregistrer un commentaire