Auroriax / PuzzleScriptPlus

Puzzlescript Plus: Open Source HTML5 Puzzle Game Engine (with lots of extra functionality)
https://auroriax.github.io/PuzzleScript/
34 stars 4 forks source link

npm compile does not work #86

Open david-pfx opened 1 year ago

david-pfx commented 1 year ago

Followed the instructions in the development guide.

d:\MyDocs\dev\Polyomino\PSNext\PS+>node compile.js
d:\MyDocs\dev\Polyomino\PSNext\PS+\compile.js:19
const gifsicle = require('gifsicle');
                 ^

Error [ERR_REQUIRE_ESM]: require() of ES Module d:\MyDocs\dev\Polyomino\PSNext\PS+\node_modules\gifsicle\index.js from d:\MyDocs\dev\Polyomino\PSNext\PS+\compile.js not supported.
Instead change the require of index.js in d:\MyDocs\dev\Polyomino\PSNext\PS+\compile.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (d:\MyDocs\dev\Polyomino\PSNext\PS+\compile.js:19:18) {
  code: 'ERR_REQUIRE_ESM'
}

Is this a known problem?

Auroriax commented 1 year ago

When you mention "development guide" do you mean https://github.com/increpare/PuzzleScript/blob/master/DEVELOPMENT.md ?

If this doesn't work, what happens if you replace require with import as the warning suggests?

david-pfx commented 1 year ago

Yes, that's the one. And I started with no npm installation, so whatever got installed is what I've got.

Right now I don't have the npm skills or bandwidth to tackle that one. I'll have to leave that to others for now.

david-pfx commented 1 year ago

Found it. Seems rimraf was updated and caused a breaking change. Lots of people affected.

Installing rimraf@3 fixes it. I've done a PR for PS. The one for PS+ has to be different.