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

Webpack Compilation error #173

Open
smile18 opened this issue Feb 24, 2017 · 10 comments
Open

Webpack Compilation error #173

smile18 opened this issue Feb 24, 2017 · 10 comments

Comments

@smile18
Copy link

smile18 commented Feb 24, 2017

Getting below error while compiling ...

WARNING in ./~/source-map-support/source-map-support.js Module not found: Error: Can't resolve 'module' in 'D:\WebStormWork\myapp\node_modules\source-map-support' @ ./~/source-map-support/source-map-support.js 474:15-32 @ ./~/bunyan/lib/bunyan.js @ ./~/ldapjs/lib/index.js @ multi webpack-dev-server/client webpack: Compiled with warnings.

@ChrisProlls
Copy link

Same as me, any ideas ?

@ordinaryorange
Copy link

I had the same error, but was able to remove the package depending on source-map-support, which then got rid of it. @smile18 If you cant remove bunyan what happens if you add the source-map-support package ?

@bzalasky
Copy link

bzalasky commented Aug 2, 2017

It appears to be caused by these lines (~470 in source-map-support.js)...

if (options.hookRequire && !isInBrowser()) {
    var Module;
    try {
        Module = require('module');
    } catch (err) {
    // NOP: Loading in catch block to convert webpack error to warning.
    ...
}

Perhaps webpack 2 is treating this differently than webpack 1 did?

@jscinoz
Copy link

jscinoz commented Oct 27, 2017

Webpack 2/3 will attempt to parse any and all ES dynamic import() / CommonJS require() calls present in input files. When the Webpack build is has target: web, neither module nor fs will be available, hence the require calls for each of these will fail to resolve and Webpack will fail the build.

To work around this, you can set node.fs and node.module both to "empty" in your Webpack configuration, e.g:

{
  /* Other configuration keys */
  node: {
    fs: "empty",
    module: "empty",
  }
}

@Ventzy
Copy link

Ventzy commented Jan 28, 2018

Any idea how to do that in angular-cli (without ng eject)?

@raed667
Copy link

raed667 commented Feb 21, 2018

up?

@ramiy
Copy link

ramiy commented Dec 16, 2018

Had the same issue:

warning  in ./node_modules/vue-monaco/node_modules/monaco-editor/esm/vs/editor/common/services/editorSimpleWorker.js

Critical dependency: the request of a dependency is an expression


warning  in ./node_modules/source-map-support/source-map-support.js

Module not found: Error: Can't resolve 'module' in '.\node_modules\source-map-support'

Solved with Webpack configure mentioned above:

node: {
  fs: 'empty',
  module: 'empty',
},

Thanks @jscinoz !!!

@JSONRice
Copy link

JSONRice commented May 7, 2019

Yeah this is an issue for me as well. Please fix your software @evanw

@LinusU
Copy link
Collaborator

LinusU commented May 8, 2019

Please fix your software

Would be happy to accept a pull request to fix this @Jasonwr ☺️

@JSONRice
Copy link

JSONRice commented May 8, 2019

@LinusU I'm strapped for time at the moment. Lots of coding these days. Also I'd have to ramp up on the internals of this package before being able to submit a defect free PR.

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

10 participants