I am not sure whether this is a node-fs or spago problem, therefor i'm cross posting. Please close when this issue is not relevant for this repo.
Reproduce & error:
mkdir nodefssync
cd nodefssync
spago init
spago install node-fs node-buffer
now paste source code into Main.purs
module Main where
import Prelude
import Effect (Effect)
import Effect.Console (log)
import Node.FS.Sync
import Node.Encoding
main :: Effect Unit
main = do
_ <- readTextFile UTF8 "blabla"
log "🍝"
spago bundle-app --platform=node
node index.js
» node index.js
(node:654122) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/home/flip111/nodefssync/index.js:109
import {
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Object.compileFunction (node:vm:360:18)
at wrapSafe (node:internal/modules/cjs/loader:1048:15)
at Module._compile (node:internal/modules/cjs/loader:1083:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1173:10)
at Module.load (node:internal/modules/cjs/loader:997:32)
at Module._load (node:internal/modules/cjs/loader:838:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:18:47
Node.js v18.8.0
I am not sure whether this is a node-fs or spago problem, therefor i'm cross posting. Please close when this issue is not relevant for this repo.
Reproduce & error:
now paste source code into
Main.purs
Related file: https://github.com/purescript-node/purescript-node-fs/blob/c6c52c510b55940bbcf475fa25913bc7eb415acb/src/Node/FS/Sync.js
Spago post: https://github.com/purescript/spago/issues/916