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

Use OpenseadragonFabricjsOverlay plugin in node application #55

Open
mirdpai opened this issue Jul 27, 2021 · 2 comments
Open

Use OpenseadragonFabricjsOverlay plugin in node application #55

mirdpai opened this issue Jul 27, 2021 · 2 comments

Comments

@mirdpai
Copy link

mirdpai commented Jul 27, 2021

Hello, I'm having difficulties using the plugin on my node application.
First I tried to treat it like any other npm package, but it seems there missing typing. An import statement just would not work (Can not find module).
While it seems that everything runs smoothly from within an HTML script tag, I just can't import fabric.adapted.js file using require. Many dependencies seem to be broken.
`./node_modules/http-proxy-agent/dist/agent.js:45:30-44 - Error: Module not found: Error: Can't resolve 'net' in 'C:\projects\WpfOpenSlide\scripts\web\studio\node_modules\http-proxy-agent\dist'

./node_modules/http-proxy-agent/dist/agent.js:47:30-44 - Error: Module not found: Error: Can't resolve 'tls' in 'C:\projects\WpfOpenSlide\scripts\web\studio\node_modules\http-proxy-agent\dist'

./node_modules/https-proxy-agent/dist/agent.js:45:30-44 - Error: Module not found: Error: Can't resolve 'net' in 'C:\projects\WpfOpenSlide\scripts\web\studio\node_modules\https-proxy-agent\dist'

./node_modules/https-proxy-agent/dist/agent.js:47:30-44 - Error: Module not found: Error: Can't resolve 'tls' in 'C:\projects\WpfOpenSlide\scripts\web\studio\node_modules\https-proxy-agent\dist'

./node_modules/jsdom/lib/api.js:5:13-28 - Error: Module not found: Error: Can't resolve 'path' in 'C:\projects\WpfOpenSlide\scripts\web\studio\node_modules\jsdom\lib'

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: { "path": require.resolve("path-browserify") }'
- install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "path": false }

./node_modules/jsdom/lib/api.js:7:11-33 - Error: Module not found: Error: Can't resolve 'fs' in 'C:\projects\WpfOpenSlide\scripts\web\studio\node_modules\jsdom\lib'

./node_modules/jsdom/lib/jsdom/browser/resources/resource-loader.js:3:11-24 - Error: Module not found: Error: Can't resolve 'fs' in 'C:\projects\WpfOpenSlide\scripts\web\studio\node_modules\jsdom\lib\jsdom\browser\resources'`
This goes on...

Would love to have your help on this. Thank you!

@skuracj
Copy link

skuracj commented Dec 1, 2021

@mirdpai
Try to add:

    "canvas": false,
    "fs": false,
    "jsdom": false,
    "jsdom/lib/jsdom/living/generated/utils": false,
    "jsdom/lib/jsdom/utils": false,
    "http": false,
    "https": false,
    "xmldom": false,
    "url": false
  },

to package.json

@linruicheng1997
Copy link

,
"url": false

I also encountered the same problem, but I followed your solution and still got the same error! Is there any other way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants