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

When building for target web with webpack - Error: Cannot find module 'fs' #163

Open
vishalsatam opened this issue Dec 13, 2022 · 0 comments

Comments

@vishalsatam
Copy link

vishalsatam commented Dec 13, 2022

I am working on an existing NodeJs web application that builds using webpack. I'm trying to add monaco-editor/react for which I need to use this package.

Package structure ... Webapp package (webpack build) -> dependencyConsumingPackage (Create React App (CRA) application) -> vscode-json-languageservice

I keep getting the below error. How do I get around this issue? Is it possible to build this package into webpack with target web (for a webapp) and how?

I saw a couple of suggestions that mentioned that I should build with target node to get around this. I can't do this because I'm trying to depend on this in a web application.
Another suggestion was to disable fs by adding node: { fs: 'empty' }, but this also did not work.

angular.js:15635 
        
       Error: Cannot find module 'fs'
    at webpackMissingModule (main.js:8:1)
    at Object.<anonymous> (main.js:8:1)
    at ./node_modules/dependencyConsumingPackage/node_modules/vscode-nls/lib/main.js (main.js:499:1)
    at __webpack_require__ (bootstrap:789:1)
    at fn (bootstrap:100:1)
    at ./node_modules/dependencyConsumingPackage/node_modules/vscode-json-languageservice/lib/esm/parser/jsonParser.js (jsonParser.js:1:1)
    at __webpack_require__ (bootstrap:789:1)
    at fn (bootstrap:100:1)
    at ./node_modules/dependencyConsumingPackage/node_modules/vscode-json-languageservice/lib/esm/services/jsonCompletion.js (jsonCompletion.js:1:1)
    at __webpack_require__ (bootstrap:789:1)
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

1 participant