简体   繁体   中英

Web Compiler converting CoffeeScript to JavaScript with require()

I'm using Web Compiler for Visual Studio 2015, and I'm trying to compile a coffeescript file into a normal javascript file, but whenever I compile the coffeescript.js file I get the javascript.js, but with:

// Generated by IcedCoffeeScript 108.0.11
(function() {
var iced;

iced = require('iced-runtime');
...

appended to the beginning. We don't use Node.js, so the require() fails and hence my AngularJS controller is unrecognized.

Is there a setting within Web Compiler that disables the insertion of the above? I just want the coffeescript compiled into normal JS.

The Web Compiler seems to be using the IcedCoffeeScript compiler, with the --runtime flag defaulting to node , causing the require you see.

You should have a compilerconfig.json at the project root. Try setting an explicit option for the runtime :

compilers: {
  coffeescript: {
    runtimeMode: 'inline' // or 'window' or even 'none'
  }
}

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