JS - Can't combine lib files

后端 未结 3 488

I have multiple lib files in an an index.html file, that are loaded in proper sequence for an app I am running.


<         


        
相关标签:
3条回答
  • 2020-12-13 13:13

    Most probably one of your js files is missing a ; at the end. Open up the one you believe is causing the error and add a ; at the end, or add a ; to the very first line of the next js file.

    0 讨论(0)
  • 2020-12-13 13:21

    Modifying the javascript code is not fixing the root cause of the problem so this could happen again as soon as you introduce a new JavaScript file.

    You have at least few choices for a permanent fix - they involve changing the build so that this cannot happen in the future, even if a semi-colon is missing:

    • Inject a ; between the files you are concatenating. This is usually a simple one-line change depending on how you are concatenating the files.
    • Minify the files first and then concatenate. This should leave a \n between the files you are concatenating, allowing ASI to take care of this for you.
    0 讨论(0)
  • 2020-12-13 13:23

    just add semi-clone and newline

    ';\n'
    

    at end of each file

    0 讨论(0)
提交回复
热议问题