Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

making artoolkitX.js as a node module #1

Open
kalwalt opened this issue Jan 25, 2020 · 0 comments
Open

making artoolkitX.js as a node module #1

kalwalt opened this issue Jan 25, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@kalwalt
Copy link
Owner

kalwalt commented Jan 25, 2020

Continue from this issue augmentmy-world/artoolkitX.js#28
I made some changes to the artoolkitx code see kalwalt/artoolkitx@cd09058 to solve the window issue error but now i got another error, running in a console from the main folder:

node index.js
(node:6659) ExperimentalWarning: The ESM module loader is experimental.
file:///home/walter/kalwalt-github/test/artoolkitxjs-nodejs/node_modules/artoolkitX.js/SDK/lib/artoolkitx.js:6
var Module=typeof artoolkitXjs!=="undefined"?artoolkitXjs:{};var scope;if(typeof window!=="undefined"){scope=window}else if(typeof window=="undefined"){scope=global}else{scope=global}if(scope.artoolkitX_wasm_url){function downloadWasm(url){return new Promise(function(resolve,reject){var wasmXHR=new XMLHttpRequest;wasmXHR.open("GET",url,true);wasmXHR.responseType="arraybuffer";wasmXHR.onload=function(){resolve(wasmXHR.response)};wasmXHR.onerror=function(){reject("error "+wasmXHR.status)};wasmXHR.send(null)})}const wasm=downloadWasm(scope.artoolkitX_wasm_url);artoolkitXjs.instantiateWasm=function(imports,successCallback){wasm.then(function(wasmBinary){var wasmInstantiate=WebAssembly.instantiate(new Uint8Array(wasmBinary),imports).then(function(output){successCallback(output.instance)}).catch(function(e){console.error("wasm instantiation failed! "+e)})});return{}}}var moduleOverrides={};var key;for(ke

ReferenceError: __dirname is not defined
    at file:///home/walter/kalwalt-github/test/artoolkitxjs-nodejs/node_modules/artoolkitX.js/SDK/lib/artoolkitx.js:6:1887
    at file:///home/walter/kalwalt-github/test/artoolkitxjs-nodejs/node_modules/artoolkitX.js/SDK/lib/artoolkitx.js:11:2

i have not an idea how to solve this at the moment. I will investigate it.

@kalwalt kalwalt added the enhancement New feature or request label Jan 25, 2020
@kalwalt kalwalt self-assigned this Jan 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant