Typescript without module loader?
typescript
Solution
In your `tsconfig.json` the `module` property should be `none`
{
"compilerOptions": {
"module": "none"
}
}
Now there are no more `amd` or `system` code. And now you can't use any more `import` and `export` statements.
Without this, TypeScript does not know the order of your scripts, and you can have Js undefined errors.
To fix this, just add a triple slash directive instead of `import` statement
Now TypeScript compile all the scripts in the right order. Also use `outFile` instead of `out` because is deprecated.
Problem
I am stuck with an old software that uses aspx pages. I have some controls (ascx) that can work almost as a small Single Page Applications (for example a control that lets you register to a Newsletter,or a control that lets the user customize the news feed). (i know... its not really a SPA... ) I started using VUE.js for this small micro-projects. I managed to make it all work with plain JavaScript. Now I wanted to use typescript instead of JavaScript. The issue I have: when I create my typescripts and reference some modules like the VUE or my own, it always writes in the generated js file some "require " commands (transpiled to ES5) or some Import commands if transpiled to ES6. As far as I read, these commands are supposed to be used by some module loaders on the server. But I don't have a Node.Js server nor a Javascript building infrastructure. Is there a way to tell typescript just to ignore those commands? I would then reference manually the needed JS-genereated files with the modules inseide y ascx-control.