netcreateorg / netcreate-itest

Developing the 2.0 version of NetCreate
https://github.com/netcreateorg/netcreate-2018
Other
1 stars 0 forks source link

`npm run classroom` is broken #240

Open benloh opened 3 months ago

benloh commented 3 months ago

npm run classroom is currently broken:

% npm run classroom

> netcreate-itest@2.0.0-alpha classroom
> brunch build -e classroom

07:52:35 - info: compiling
07:52:39 - info: compiling.
07:52:43 - info: compiling..
07:52:47 - info: compiling...
07:52:52 - info: compiling
07:53:00 - error: Optimizing of public/scripts/netc-lib.js failed. L170504:0 Unexpected token: punc ())
Stack trace was suppressed. Run with `LOGGY_STACKS=1` to see the trace. 

Do we need to re-enable this for DO deployment? e.g. see README notes from nc-multiplex:

IMPORTANT: Do NOT build it with npm run dev or Net.Create will try to enable autoreload (used for detecting changes in code and restarting the server during development). This will result in a slow startup as well as repeated connection failures to port 9485 for autoreload. If you see messages like this in your console, you probably built NetCrate using npm run dev:

WebSocket connection to 'ws://*:9485/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED or

Firefox can’t establish a connection to the server at ws://*:9485/. auto-reload.js:69:21

dsriseah commented 1 month ago

The issue is related to terser, an optimization plugin that is likely no longer conversant with modern javascript post 2016. This hasn't been updated in years. Quick solution is to remove the terser field in brunch-config.js and retest.

  overrides: {
    // env 'classroom' is set by npm start / npm run start
    classroom: {
      optimize: true,
      sourceMaps: false,
      plugins: {
        autoReload: { enabled: false },
        terser: {
          ecma: 2016,
          mangle: false
        }
      },

if it still doesn't work, try changing optimize to false.

dsriseah commented 1 month ago

This change should allow the installation instructions for nc-multiplex to change back to using npm run classroom to config, rather than npm run package which is for standalone installations.