Exports added when module = "none"
This seems to be related to the recent introduction of VS 2017.
With the preprocessor options of:
typescriptPreprocessor: {
target: 'ES5',
module: 'none',
sourceMap: false,
noImplicitAny: false
},
When I run Karma I get:
Uncaught ReferenceError: exports is not defined
at apps/controls/app-controls.js:4
and the code in the generated JavaScript contains:
"use strict";
exports.__esModule = true;
angular.module('controls.directives', []);
angular.module('controls.filters', ['controls.services']);
angular.module('controls.services', []);
...
I'm having the same issue. It happened when I tried to update to TypeScript 2.2.1 but it works in 2.1.6.
this is an issue with typescript and ist discussed here https://github.com/Microsoft/TypeScript/issues/14351 and here https://github.com/Microsoft/TypeScript/issues/14456
it will be fixed in typescript 2.3 https://github.com/Microsoft/TypeScript/pull/14493
it works when i install typescript@next as a dependency. However, you have to tell the preprocessor explicitely what typescript version should be used. Looks like this:
typescriptPreprocessor: {
options: require('./tsconfig').compilerOptions,
typescript: require('typescript')
},
Any updates on this, I'm still getting:
exports.__esModule = true;
with those configs:
{ "compilerOptions": { "rootDir": "./src/", "alwaysStrict": false, "baseUrl": "./", "target": "ES3", "lib":["ES5", "ES2015.Promise"], "outDir":"./dist/", "module": "none" } }
I'm using 2.9.0-dev.20180403