JetBrains Rider 2017.3 Help

Running CoffeeScript

CoffeeScript code is not processed by browsers that work with JavaScript code. Therefore to be executed, CoffeeScript code has to be translated into JavaScript. This operation is referred to as compilation and the tools that perform it are called compilers.

In either case, running CoffeeScript is supported only in the local mode. This means that JetBrains Rider itself starts the Node.js engine and the target application according to a run configuration and gets full control over the session.

For more details about running Node.js applications, see Running and Debugging Node.js.

There are two approaches to running CoffeeScript in JetBrains Rider:

  • Compile the CoffeeScript code manually and then run the output JavaScript code as if it were a Node.js application.
  • Run the original CoffeeScript code through the Node.js run configuration and have JetBrains Rider compile it on the fly.

Compiling CoffeeScript manually and running the generated JavaScript code

  1. Compile the CoffeeScript code into Javascript.
  2. Start creating a Node.js run configuration with the following mandatory settings:
    1. The Node.js engine to use. By default, the field shows the path to the interpreter specified on the Node.js page during Node.js configuration.
    2. In the Working directory field, specify the location of the files referenced from the starting CoffeeScript file to run, for example, includes. If this file does not reference any other files, just leave the field empty.
    3. In the Path to Node App JS File text box, specify the full path to the JavaScript file that was generated from the original CoffeeScript file during the compilation.
  3. Save the configuration and click run.png on the toolbar.
  4. Proceed as while running a Node.js application.

Compile CoffeeScript on the fly during run

  1. This mode requires that the register.js file, which is a part of the coffee-script package, should be located inside the project. Therefore you need to install the coffee-script package on the Node.js page locally, as described in NPM.
  2. Open the starting CoffeeScript file in the editor or select in the Project tool window and choose Create <CoffecScript_file_name> on the context menu. Alternatively, start creating a Node.js run configuration as described in Running and Debugging Node.js. In the Run/Debug Configuration: Node.js dialog that opens, specify the following mandatory settings:
    1. The Node interpreter to use. Select the relevant interpreter configuration or create a new one, see By default, the field shows the path to the interpreter specified on the Node.js page during Node.js configuration.

      For Linux and macOS, this setting is overridden by the Node.js from the path to the CoffeeScript compiler executable file.

    2. In the Node parameters text box, type the following:
      --require coffee-script/register
    3. In the Working directory field, specify the working directory of the application. All references in the starting CoffeeScript file, for example, imports, will be resolved relative to this folder, unless such references use full paths.

      By default, the field shows the project root folder. To change this predefined setting, choose the desired folder from the drop-down list, or type the path manually, or click the Browse button browseButton.png and select the location in the dialog box, that opens.

    4. In the JavaScript file text box, specify the full path to the CoffeeScript file to run.

    Note that all the mandatory fields will be filled in automatically if you create a run configuration directly from the required CoffeeScript file.

  3. Save the configuration and click run.png on the toolbar.
  4. Proceed as while running a Node.js application.
Last modified: 19 April 2018