On this page:
The mapping for this definitions is equivalent to the following code:
The generated code exports the top-level modules. For browsers it adds symbols to the global window object and for NodeJS it uses the native exports object.
When developing for NodeJS, you include the various Ice components with
require statements as shown below:
Importing the generated code for your own Slice definitions works the same way:
This example assumes the generated Slice definitions are in the file
Ice.js shown above only provides definitions for the Ice run time; you would need to explicitly include the corresponding files for any other Ice components that your application needs, such as
[["js:es6-module"]] global metadata to enable the new module mapping:
--module es6 to tell the compiler that you want to resolve imports using es6 modules.
Using ES6 modules in the browser
The global metadata [["
The Gulp Ice Builder will generate a bundle for the "chat" module named
chat.js, when the typescript option is enabled it will also generate a TypeScript definitions file
chat.d.ts, you can use the generated code by importing the generated chat.js file from your application as in:
The generated code for Slice definitions in a different module, will import the "chat" module as show in the following sample
- Using the Slice Compilers