brownplt / pyret-lang

The Pyret language.
Other
1.06k stars 106 forks source link

Update webpack and related libs to newest versions #1726

Closed jpolitz closed 4 months ago

jpolitz commented 5 months ago

This commit updates webpack to the newest version and enables building on node 20+. There are a lot of details here.

jpolitz commented 5 months ago

I think there are things we can remove from both package.jsons, but that's maybe an analysis for another day.

I also need to debug a message that prints (but seems to not stop or otherwise affect the build creating the needed files?). So this isn't yet ready to merge, more work to do, but basically at the point where I got a local build to start up the editor and create files, run image library stuff, etc.

> my-webpack-project@1.0.0 build
> webpack --mode=production --node-env=production

SyntaxError: Invalid regular expression: /[^'\]/: Unterminated character class
    at new RegExp (<anonymous>)
    at /Users/joe/src/pyret-lang-anchor-clean/ide/node_modules/webpack/lib/javascript/JavascriptParser.js:526:52
    at Hook.eval [as call] (eval at create (/Users/joe/src/pyret-lang-anchor-clean/ide/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:16)
    at JavascriptParser.evaluateExpression (/Users/joe/src/pyret-lang-anchor-clean/ide/node_modules/webpack/lib/javascript/JavascriptParser.js:3833:25)
    at /Users/joe/src/pyret-lang-anchor-clean/ide/node_modules/webpack/lib/javascript/JavascriptParser.js:1516:30
    at Hook.eval [as call] (eval at create (/Users/joe/src/pyret-lang-anchor-clean/ide/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:16)
    at JavascriptParser.evaluateExpression (/Users/joe/src/pyret-lang-anchor-clean/ide/node_modules/webpack/lib/javascript/JavascriptParser.js:3833:25)
    at JavascriptParser.getRenameIdentifier (/Users/joe/src/pyret-lang-anchor-clean/ide/node_modules/webpack/lib/javascript/JavascriptParser.js:1619:23)
    at JavascriptParser.walkVariableDeclaration (/Users/joe/src/pyret-lang-anchor-clean/ide/node_modules/webpack/lib/javascript/JavascriptParser.js:2540:31)
    at JavascriptParser.walkStatement (/Users/joe/src/pyret-lang-anchor-clean/ide/node_modules/webpack/lib/javascript/JavascriptParser.js:1856:10)
SyntaxError: Invalid regular expression: /[^"\]/: Unterminated character class
    at new RegExp (<anonymous>)
    at /Users/joe/src/pyret-lang-anchor-clean/ide/node_modules/webpack/lib/javascript/JavascriptParser.js:526:52
    at Hook.eval [as call] (eval at create (/Users/joe/src/pyret-lang-anchor-clean/ide/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:16)
    at JavascriptParser.evaluateExpression (/Users/joe/src/pyret-lang-anchor-clean/ide/node_modules/webpack/lib/javascript/JavascriptParser.js:3833:25)
    at /Users/joe/src/pyret-lang-anchor-clean/ide/node_modules/webpack/lib/javascript/JavascriptParser.js:1517:29
    at Hook.eval [as call] (eval at create (/Users/joe/src/pyret-lang-anchor-clean/ide/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:16)
    at JavascriptParser.evaluateExpression (/Users/joe/src/pyret-lang-anchor-clean/ide/node_modules/webpack/lib/javascript/JavascriptParser.js:3833:25)
    at JavascriptParser.getRenameIdentifier (/Users/joe/src/pyret-lang-anchor-clean/ide/node_modules/webpack/lib/javascript/JavascriptParser.js:1619:23)
    at JavascriptParser.walkVariableDeclaration (/Users/joe/src/pyret-lang-anchor-clean/ide/node_modules/webpack/lib/javascript/JavascriptParser.js:2540:31)
    at JavascriptParser.walkStatement (/Users/joe/src/pyret-lang-anchor-clean/ide/node_modules/webpack/lib/javascript/JavascriptParser.js:1856:10)
jpolitz commented 5 months ago

OK found the culprit which was indeed a bad regex we wrote in dead code in the codemirror mode:

https://github.com/brownplt/pyret-codemirror-mode/commit/1862b0aa3b934035722ff23fd102da8bdd5454be