Why am I getting the following error? Did I forget to include a script in my html?
ReferenceError: Can't find variable: exports
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/* more code */
tsconfig.json
{
"compileOnSave": true,
"compilerOptions": {
"target": "es5",
"noImplicitAny": true,
"rootDir": ".",
"sourceRoot": "../../../",
"outDir": "../../../js/dist/",
"sourceMap": false
},
"exclude": [
"node_modules"
]
}
requirejs is included before my js files in html
There are similar questions but this is simply about typescript and not about ember/babel/etc.
I can't reproduce. Your tsconfig.json
causes tsc
to bail with
error TS5051: Option 'sourceRoot can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided.
Once I remove the sourceRoot
option, there are no references to exports
in the output.
$ ls
my.ts tsconfig.json
$ cat my.ts
console.log(1)
$ cat tsconfig.json
{
"compileOnSave": true,
"compilerOptions": {
"target": "es5",
"noImplicitAny": true,
"rootDir": ".",
"sourceRoot": "../../../",
"outDir": "../../../js/dist/",
"sourceMap": false
},
"exclude": [
"node_modules"
]
}
$ tsc --version
Version 3.5.3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With