BabylonJS / Editor

Community managed visual editor for Babylon.js
http://editor.babylonjs.com/
813 stars 232 forks source link

Allow standalone build without spinning up the webserver #367

Closed ggcaponetto closed 2 years ago

ggcaponetto commented 2 years ago

I'd expect to be able build the babylon project running the following commands in sequence:

  1. npm run clean
  2. npm run compile
  3. npm run build --- which runs ---> (node --trace-warnings node_modules/webpack/bin/webpack.js --mode production)

Currently the build process doesn't exit and is waiting from some sort of connection to the webserver. The only way to build from a CI environment, is to spin up the webserver first and perform the following commands, which is cumbersome.

Working build procedure:

  1. npm run webserver
  2. npm run clean
  3. npm run compile
  4. npm run build --- which runs ---> (node --trace-warnings node_modules/webpack/bin/webpack.js --mode production)

Is there a way to get around this?

My current workaround is:

"scripts": {
...
        "clean": "rimraf build declaration dist",
        "compile": "tsc -p .",
        "build": "node --trace-warnings node_modules/webpack/bin/webpack.js --mode production",
        "build-ci": "concurrently \"npm run webserver\" \"npm wait-on -v -d 3000 http://localhost:1338/dist/bundle.js && npm run build\" --success first --kill-others",
...
    }
eherozhao commented 2 years ago

@ggcaponetto To clarify, are you using BabylonJS Editor to build your project?

ggcaponetto commented 2 years ago

@eherozhao yes, I am using the Editor (Version 4.1.0) and I'd like to build the project without having to open the Editor. If I run the npm run build command, the bundle is compiled and put into the dist folder, but the process hangs and doesn't return an exit code. Digging a little deeper I noticed that the build process is waiting to connect and notify the Editor.

julien-moreau commented 2 years ago

Hi @ggcaponetto ! I found the problem and fixed it!

In the package.json of your project, please use version 1.0.3 of babylonjs-editor-webpack-progress. The problem the webpack plugin never closed the socket to notify the editor of the progress.

Sorry for that bug and the delay. Can you confirm that it fixed in your CI? Thanks :)

ggcaponetto commented 2 years ago

@julien-moreau thank you very much. Version 1.0.3 fixes the npm build script; now I am able to build without having the editor open.

I am loving the Editor. Thank you very much for your hard work.