microsoft/just

Building multiple entry points fails most of the time

LokiMidgard opened this issue · 0 comments

I try to build (npm run build) multiple entry points for my app. This fails most of the time. Building 6 times only works once (not statistically correct).

I don't change anything between builds, just execute npm run build until it works. Executing it again after a success has a high probability of failure.

I have a test project to demonstrate this.

The webpack.config.js I try to build:

const path = require('path');

function makeWebpack(inputPath) {
  if (inputPath.length > 0 && !inputPath.startsWith('/')) {
    inputPath = '/' + inputPath;
  }
  return webpackMerge(
    webpackConfig,
    htmlOverlay({
      template: 'public/index.html'
    }),
    {
      entry: './src' + inputPath + '/index',
      output: {
        path: path.join(process.cwd(), 'dist/', inputPath),
      }
    }
  );
};

const { webpackMerge, htmlOverlay, webpackConfig } = require('just-scripts');
module.exports = [
  makeWebpack(''),
  makeWebpack('S1'),
];

The error I get when it is not working:

~\source\repos\justTest [master+0 ~1 -0 !]> npm run build

> justTest-single@0.1.0 build C:\Users\p.kranz\source\repos\justTest
> just-scripts build

[15:01:28] ■ started 'build'
[15:01:28] ■ started 'ts'
[15:01:28] ■ started 'ts:esm'
[15:01:28] ■ Running C:\Users\p.kranz\source\repos\justTest\node_modules\typescript\lib\tsc.js with C:\Users\p.kranz\source\repos\justTest\tsconfig.json
[15:01:28] ■ Executing: "C:\Program Files\nodejs\node.exe" "C:\Users\p.kranz\source\repos\justTest\node_modules\typescript\lib\tsc.js" --module esnext --outDir lib --project "C:\Users\p.kranz\source\repos\justTest\tsconfig.json"
[15:01:41] ■ finished 'ts:esm' in 12.67s
[15:01:41] ■ finished 'ts' in 12.68s
[15:01:41] ■ started 'webpack'
[15:01:44] ■ Running Webpack
[15:01:44] ■ Webpack Config Path: C:\Users\p.kranz\source\repos\justTest\webpack.config.js
Starting type checking service...
Using 1 worker with 2048MB memory limit
[15:02:05] x Other tasks that did not complete: [build, webpack]
~\source\repos\justTest [master ≡]>

The success looks like follow:

~\source\repos\justTest [master+0 ~1 -0 !]> npm run build

> justTest-single@0.1.0 build C:\Users\p.kranz\source\repos\justTest
> just-scripts build

[14:56:04] ■ started 'build'
[14:56:04] ■ started 'ts'
[14:56:04] ■ started 'ts:esm'
[14:56:04] ■ Running C:\Users\p.kranz\source\repos\justTest\node_modules\typescript\lib\tsc.js with C:\Users\p.kranz\source\repos\justTest\tsconfig.json
[14:56:04] ■ Executing: "C:\Program Files\nodejs\node.exe" "C:\Users\p.kranz\source\repos\justTest\node_modules\typescript\lib\tsc.js" --module esnext --outDir lib --project "C:\Users\p.kranz\source\repos\justTest\tsconfig.json"
[14:56:18] ■ finished 'ts:esm' in 13.37s
[14:56:18] ■ finished 'ts' in 13.37s
[14:56:18] ■ started 'webpack'
[14:56:20] ■ Running Webpack
[14:56:20] ■ Webpack Config Path: C:\Users\p.kranz\source\repos\justTest\webpack.config.js
Starting type checking service...
Using 1 worker with 2048MB memory limit
[14:56:46] ■ finished 'webpack' in 28.88s
[14:56:46] ■ finished 'build' in 42.27s
~\source\repos\justTest [master+0 ~1 -0 !]> npm run build