Skip to content

Commit

Permalink
Run dicc synchronously
Browse files Browse the repository at this point in the history
  • Loading branch information
Serg046 committed Nov 14, 2024
1 parent 5ecb2c2 commit a2bbd93
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions webpack.plugins.babel.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from 'fs';
import crypto from 'crypto';
import path from 'path';
import { exec } from 'child_process';
import { execSync } from 'child_process';

function getAsset(compilation: any) {
let assetName = Object.keys(compilation.assets).find(fileName => fileName.startsWith('main.') && fileName.endsWith('.js'));
Expand Down Expand Up @@ -74,21 +74,21 @@ export class DiccCompilerPlugin {
}

compile() {
const t = performance.now();
exec('npm run di', (err, stdout, stderr) => {
if (err) {
console.error(`Error executing command: ${err}`);
if (stdout) {
console.log(`stdout: ${stdout}`);
}
if (stderr) {
console.error(`stderr: ${err}`);
}
return;
const startTime = performance.now();
try {
execSync('npm run di');
}
catch (err) {
if (err.stdout) {
console.log(err.stdout.toString());
}
if (err.stderr) {
console.log(err.stderr.toString());
}
throw new Error('dicc failed to compile');
}

console.log(`dicc compiled successfully in ${Math.round(performance.now() - t)} ms`);
});
console.log(`dicc compiled successfully in ${Math.round(performance.now() - startTime)} ms`);
}
}

Expand Down

0 comments on commit a2bbd93

Please sign in to comment.