-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
Hi
I want to use this in node.JS environment on local Windows PC, not on web browser.
Just for test, I wrote such ad-hoc code (without webpack or any packaging) and run:
const loam = require("loam")
loam.initialize()
const main = async () => {
const file = 'png/Nara-Genpyo.png'
const dataset = await loam.open(file)
const width = await dataset.width()
console.log(width)
}
main()
The result is error follow:
ReferenceError: self is not defined
at Object.<anonymous> (F:\github\loam\node_modules\loam\lib\loam.js:1:197)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (F:\github\loam\index.js:1:14)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
I changed the code like this, but still same error occurs.
const main = async () => {
const loam = await import("loam")
loam.initialize()
const file = 'png/Nara-Genpyo.png'
const dataset = await loam.open(file)
const width = await dataset.width()
console.log(width)
}
main()
Is this expected result?
Loam don't work in node.js environment or it always must be used with webpack-like packager?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels