简体   繁体   中英

r.js fails to compile

I'm working on a project which involves many JavaScript files and uses require.js to manage them.

Everything works fine and there are no browsers errors and my code is exactly fine with lintjs (I'm using CoffeeScript). However, when I try to optimize my scripts into one fail, the operation fails. I installed r.js with npm

Command executed

r.js -o main.js

Error Message

Error: Build file /devl/premiumthemes/wp-content/themes/premiumthemes/views/files/js/main.js is malformed: SyntaxError: Unexpected token ;
    at Function.build.createConfig (/usr/local/lib/node_modules/requirejs/bin/r.js:22611:23)

What could be possibly going wrong?

The optimizer for RequireJs, r.js, requires either a build file or some parameters inline detailing the settings to be used (including things like the files or directories to be optimized, the file that comes out, and so on).

More info on r.js optimization can be found at RequireJS Optimization .

All the different configuration options can be seen in an example build file as well

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM