I am using gulp, browserify and tsify to bundle my application and I am pointing browserify to the main.ts file. That is all I am doing to bundle the app. But when I try to run the index.html file which has the bundled js file imported, I get the error: this._nativeError is undefined with a blank screen.
My tsconfig.json:
{
"compileOnSave": false,
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",
"outDir": "../dist/out-tsc-e2e",
"sourceMap": true,
"target": "es5",
"typeRoots": [
"../node_modules/@types"
]
}
}
My gulp task:
Regarding the
tsifyconfiguration, you define:but you use:
It's unclear as to whether or not it's related to your problem, but if your
tsconfig.jsonis not in the same directory as yourpackage.jsonand is not in a parent directory, it won't be found. And as your configuration includes../node_modules/@types, it seems likely that it's not.To let
tsifyknow where thetsconfig.jsonis, you can specify theprojectoption: