Symfony 2 - Javascript compression compression causing errors

I am trying to put a Symfony 2 application into production mode. Everything works fine, except for the fact that a compressed single javascript file causes errors and makes the site unable to render correctly. I found this through the debug console in the browser:

Uncaught TypeError: undefined is not a function Uncaught TypeError: Object [object Object] has no method 'treeview' 

The first error relates to jQuery plugins. A tree designation refers to a jQuery plugin that displays a tree as a directory structure.

On the other hand, all this works fine in dev mode, because it does not perform compression, and it just includes each file one at a time. Can someone help me with this? Thanks in advance.

+6
source share
1 answer

I found a solution for this, it seems the problem is due to the lack of half-columns. When something is the last statement in the js file, it is not necessary to use a colon, but assetic just concatenates the files and adds only a new line.

Check the file that is included immediately before the broken javascript plugin and make sure it ends with a semicolon.

+13
source

Source: https://habr.com/ru/post/909537/


All Articles