Hi,
I installed PureScript 0.15.2 and it works so far for me unless I use Affjax and do bundle the code for node.
This code works with spago run
main :: Effect Unit
main = launchAff_ do
result <- get json "http://www.thecocktaildb.com/api/json/v1/1/random.php"
case result of
Left err -> liftEffect $ log $ printError err
Right r -> liftEffect $ log $ show $ stringify <$> decodeJson r.body
but shows the following error if I spago bundle-app --platform node
and run it using node .
file:///Users/mwu/tmp/affjax-test/index.js:12
throw new Error('Dynamic require of "' + x + '" is not supported');
^
Error: Dynamic require of "http" is not supported
at file:///Users/mwu/tmp/affjax-test/index.js:12:9
at Object.<anonymous> (file:///Users/mwu/tmp/affjax-test/index.js:88:14)
at node_modules/xhr2/lib/xhr2.js (file:///Users/mwu/tmp/affjax-test/index.js:763:8)
at __require2 (file:///Users/mwu/tmp/affjax-test/index.js:15:51)
at file:///Users/mwu/tmp/affjax-test/index.js:4095:27
at ModuleJob.run (node:internal/modules/esm/module_job:198:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:385:24)
at async loadESM (node:internal/process/esm_loader:88:5)
at async handleMainPromise (node:internal/modules/run_main:61:12)
Could you please tell me if I miss something here and how to fix it?
I use purs 0.15.2, spago 0.20.9, esbuild 0.14.42, and node 16.15.1.
Kind regards,
Markus