Skip to content

Commit

Permalink
fix: fixed build
Browse files Browse the repository at this point in the history
  • Loading branch information
teclone committed Mar 14, 2020
1 parent d67b66e commit 18b121f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 23 deletions.
30 changes: 7 additions & 23 deletions src/modules/Bundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,8 @@ class Bundler {
return result;
}

async runBuild(
promises: Promise<any>[],
moduleFiles: ModuleFiles,
config: DistConfig | CJSConfig | ESMConfig,
) {
runBuild(moduleFiles: ModuleFiles, config: DistConfig | CJSConfig | ESMConfig) {
const promises: Array<Promise<any>> = [];
const { assetFiles, typeDefinitionFiles, buildFiles } = moduleFiles;
if (config.enabled) {
log(chalk.yellow(`generating ${config.format} builds...\n`));
Expand Down Expand Up @@ -298,6 +295,7 @@ class Bundler {
if (this.bundlerOptions.generateOutputLogs) {
log(chalk.green(`${oldRelativePath} ... ${out} \n`));
}
return null;
});
})
.catch(onError),
Expand Down Expand Up @@ -326,22 +324,8 @@ class Bundler {
);
});
}
}

/**
* runs build process for a specific module
* @param moduleFiles
* @param config
*/
async processModule(
moduleFiles: ModuleFiles,
config: CJSConfig | ESMConfig | DistConfig,
) {
let promises: Promise<any>[] = [];
await this.runBuild(promises, moduleFiles, config);
return Promise.all(promises).then(() => {
return (promises = null);
});
return Promise.all(promises);
}

/**
Expand All @@ -351,9 +335,9 @@ class Bundler {
// assemble module files
const moduleFiles = await this.getModulesFiles();

await this.processModule(moduleFiles, this.config.cjsConfig);
await this.processModule(moduleFiles, this.config.esmConfig);
await this.processModule(moduleFiles, this.config.distConfig);
await this.runBuild(moduleFiles, this.config.cjsConfig);
await this.runBuild(moduleFiles, this.config.esmConfig);
await this.runBuild(moduleFiles, this.config.distConfig);
}
}

Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"skipLibCheck": true,
"noUnusedLocals": true,
"noUnusedParameters": false,
"esModuleInterop": true,
"module": "esnext",
"jsx": "react",
"lib": ["dom", "es5", "es2015.collection", "es2015.iterable"],
Expand Down

0 comments on commit 18b121f

Please sign in to comment.