Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gulp-typescript needs greater memory when the numbers of projects increase #655

Open
ericcaigm opened this issue Sep 7, 2020 · 0 comments

Comments

@ericcaigm
Copy link

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.

@ericcaigm ericcaigm changed the title Gulp-typescript need greater memory when the numbers of projects increase Gulp-typescript needs greater memory when the numbers of projects increase Sep 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant