phetsims / perennial

Maintenance tools that won't change with different versions of chipper checked out
MIT License
2 stars 5 forks source link

Import SimVersion global in sims #336

Closed zepumph closed 8 months ago

zepumph commented 10 months ago

Instead of making SimVersion a preload, let's load it using the fun new pattern in https://github.com/phetsims/chipper/issues/1409. This will help us greatly for PhET-iO, which is consistently running into a race condition trying to use SimVersion from Client.

Update: It won't help us greatly, but it is still worth doing and won't be too challenging.

zepumph commented 8 months ago

I ran into trouble sending SimVersion through webpack in this strategy. Error on build:

Fatal error: Perennial task failed:
ModuleNotFoundError: Module not found: Error: Can't resolve 'assert' in 'C:\Users\mjkauzmann\PHET\git\chipper\dist\js\perennial-alias\js\common'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "assert": require.resolve("assert/") }'
        - install 'assert'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "assert": false }

I would much prefer to get this file into typescript than to try to debug this issue further. See https://github.com/phetsims/chipper/issues/1272. Closing