Skip to content

Line lengths in concatenated Javascript files exceed 32K #3

Closed

Description

@ngEdmundas

During the deployment multiple Javascript files referenced from the index.html get concatenated to a single Javascript file if the <script> tags follow each other. The concatenated Javascript file contains a line longer than 32K, as shown by the following awk output:

awk '{print length}' .tmp/33286eca407d88980ae3d2a87c81c1fb87d7c5df.js
32116
32075
32006
32161
32053
32089
32031
32012
32035
32059
32034
32084
**36677**
32005
32057
32086
32019
32016
32093
32038
32036
32362
32755

Script with lines over 32K couldn't be loaded by the browser (Chrome, Firefox).

Activity

  1. ngEdmundas commented on Jan 18, 2014

    @ngEdmundas
    Author

    Apparently browsers can tolerate lines longer than 32K, the limit of 32K was a default value used by minifiers. However, when Javascript gets concatenated and minified by firebase deploy, Angular application fails to initialize. Most of the original Javascript files already have been minimized before the deployment.

    The following fragment in minified firebase.js

    function wb(){return ba.navigator?ba.navigator.userAgent:l}
    ...
    

    fails with a message:

    Uncaught TypeError: Cannot read property 'navigator' of undefined d1292141b6c27c54c0d35de96155e7cddf33c368.js:9
    wb d1292141b6c27c54c0d35de96155e7cddf33c368.js:9
    (anonymous function) d1292141b6c27c54c0d35de96155e7cddf33c368.js:10
    (anonymous function) d1292141b6c27c54c0d35de96155e7cddf33c368.js:11
    

    As a consequence of this error, Angular cannot instantiate the main application module:

    Uncaught Error: [$injector:modulerr] Failed to instantiate module FirstRevenueApp due to:
    Error: [$injector:nomod] Module 'FirstRevenueApp' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
    http://errors.angularjs.org/1.2.8-build.2073+sha.a7aa4cc/$injector/nomod?p0=FirstRevenueApp
        at https://353a23c500dde3b2ad58-c49fe7e7355d384845270f4a7a0a7aa1.ssl.cf2.rackcdn.com/bundles/d1292141b6c27c54c0d35de96155e7cddf33c368.js:5:14433
    ...
    

    The original deployed application that crashes with the above errors is available at URL: https://1st-revenue-casper.firebaseapp.com/

    The same application does not crash when launched from a modified index file that prevents concatenation of some Javascript files by inserting dummy HTML tags. It was deployed at URL https://1st-revenue-casper.firebaseapp.com/ndx.html.

  2. cbraynor commented on Jan 20, 2014

    @cbraynor

    I'm afraid this has something to do with the way the provider we're using to prototype this beta processes the files after they've been uploaded. We're working on removing this feature soon, or at the very least allowing a developer to disable it, but in the meantime I apologize for the inconvenience.

    Thank you for your patience

  3. ngEdmundas commented on Jan 20, 2014

    @ngEdmundas
    Author

    Thanks Chris, small change of the index file helped to prevent this very aggressive minification, but I look forward to the option to disable minifaction when the files were already minified by the app build process.

  4. cbraynor commented on Feb 4, 2014

    @cbraynor

    The minification step should now have been disabled on all deploys so this should no longer be an issue. Thanks for the interest

  5. added a commit that references this issue on Apr 18, 2024
  6. added 2 commits that reference this issue on Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions