Reputation: 1921
I have VS2015 project where I'm using typescript (ES5 with AMD). My main.ts file looks:
import {Aurelia} from 'aurelia-framework';
export function configure(aurelia: Aurelia) {
aurelia.use
.standardConfiguration()
.developmentLogging();
aurelia.start().then(a => a.setRoot());
}
But when I compile it, I get:
Unhandled promise rejection Error: define is not a function Error loading https://localhost/Web/dist/main.js at execute (https://localhost/Web/dist/main.js:7:13)
which is:
define(["require", "exports"], function (require, exports) {
Don't understand.
Thanks for any help
Upvotes: 2
Views: 540
Reputation: 275997
define is not a function
As soon as you do import
/ export
at the root level of you file, your file becomes a module and you need to have the corresponding module loader (more)
In your case it seems you are compiling with --module amd
, and I recommend looking into using requirejs
which is the most popular implementation of AMD.
PS: I personally swear by webpack / --module commonjs
/ NPM.
Upvotes: 1