gulp-typescript
gulp-typescript copied to clipboard
UnhandledPromiseRejectionWarning: Error: TypeScript: Compilation failed
error description:
....
TypeScript: 76 semantic errors
TypeScript: emit succeeded (with errors)
(node:17577) UnhandledPromiseRejectionWarning: Error: TypeScript: Compilation failed
at Output.mightFinish (/.../node_modules/[email protected]@gulp-typescript/release/output.js:130:43)
at applySourceMap.then.appliedSourceMap (/..../node_modules/[email protected]@gulp-typescript/release/output.js:65:22)
(node:17577) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:17577) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
build.js
const tsProject = ts.createProject(path.join(__dirname, '../tsconfig.json'), {
getCustomTransformers: () => ({
before: [
kobexClassTransformer(),
kobexMethodsTransformer(),
],
}),
})
task('ts', (done) => {
const res = src([tsFileGlob])
.pipe(tsProject())
.pipe(through.obj((chunk, encoding, cb) => {
const transformedFile = chunk.clone()
transformedFile.contents = Buffer.concat([Buffer.from('/* istanbul ignore file */\n'), chunk.contents])
cb(null, isProd ? chunk : transformedFile)
}))
.pipe(dest(targetPath))
.once("error", function () {
this.once("finish", () => process.exit(1));
})
done()
return res
})
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"types": ["mini-types", "./@types"],
"declaration": true,
"plugins": [
{ "transform": "@ali/ts-transform-kobex/lib/class-transformer" },
{ "transform": "@ali/ts-transform-kobex/lib/methods-transformer" }
],
"lib": ["es5", "es2015.promise", "es2015.collection", "es2015.iterable", "dom"]
},
"include": ["src/**/*.ts"],
}
remove this code block , There is still a compilation error .once("error", function () { this.once("finish", () => process.exit(1)); })
"gulp": "^4.0.2", "gulp-typescript": "^5.0.1",
resolved?
I have the same problem, help!
I have the same problem, how can I solve it?
@wuhaiyang Have you solved it yet?