From e464a9fbbaf82bcd2019253cb9dabfc8227e1c97 Mon Sep 17 00:00:00 2001 From: badlogic Date: Wed, 15 Mar 2017 10:39:05 +0100 Subject: [PATCH] [ts] Updated README on ES6 modules. --- spine-ts/README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spine-ts/README.md b/spine-ts/README.md index 254051b7b..437244007 100644 --- a/spine-ts/README.md +++ b/spine-ts/README.md @@ -40,6 +40,18 @@ All `*.js` files are self-contained and include both the core and respective bac If you write your app with TypeScript, additionally copy the corresponding `build/spine-*.d.ts` file to your project. +**Note:** If you are using the compiled `.js` files with ES6 or other module systems, you have to add + +``` +export { spine }; +``` + +At the bottom of the `.js` file you are using. You can then import the module as usual, e.g.: + +``` +import { spine } from './spine-webgl.js'; +``` + ## Examples To run the examples, the image, atlas, and JSON files must be served by a webserver, they can't be loaded from your local disk. Spawn a light-weight web server in the root of spine-ts, then navigate to the `index.html` file for the example you want to view. E.g.: