gulp-typescript
gulp-typescript copied to clipboard
Gulp-typescript needs greater memory when the numbers of projects increase
Expected behavior: I create 20 projects with the following gulpfile attached below. It need set the "--max-old-space-size=8192". My question is why it needs so much memory?
When i add this code to gulp-typescript compiler.js in the bottom of "inputDone" function. inputDone() { ... this.program = undefined; --- the added
this.project.output.finish(result); }
Then it is ok, it does not need so much memory. So, do i have method to release the typescript program in the gulpfile?
Actual behavior:
Your gulpfile: const packages: IotSdkPackage[] = [ { name: 'common', project: createProject('src/common/tsconfig.json'), }, { name: 'log-serverless', project: createProject('src/log-serverless/tsconfig.json'), }, { name: 'utils', project: createProject('src/utils/tsconfig.json'), }, { name: 'lambda', project: createProject('src/lambda/tsconfig.json'), }, // other projects ];
The tasks:
function buildPackage(tsPackage: IotSdkPackage) {
let releaseDir = dist;
return tsPackage.project
.src()
.pipe(tsPackage.project())
.pipe(dest(${releaseDir}/${tsPackage.name}));
}
Include your gulpfile, or only the related task (with ts.createProject).
tsconfig.json
Include your tsconfig, if related to this issue.
The main tsconfig.json
{
"compilerOptions": {
"target": "es2017",
"module": "commonjs",
"allowJs": true,
"declaration": true,
"sourceMap": true,
"outDir": "./dist",
"strict": true,
"noImplicitAny": true,
"strictPropertyInitialization": false,
"moduleResolution": "node",
"baseUrl": "./",
"paths": {
"*": ["node_modules/*"]
}
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"forceConsistentCasingInFileNames": true
},
"include": ["src/**/*", "test/**/*", "test-it/**/*", "tools/**/*"],
"exclude": ["node_modules", "./node_modules", "./node_modules/*", "./node_modules/@types/node/index.d.ts", "*.js"]
}
The sub tsconfig.json in each project
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"baseUrl": "./"
},
"include": ["*.ts", "**/*.ts"]
}
Code
Include your TypeScript code, if necessary.