request: Webpack compatibility error

I am using webpack to package our server-side code.When I bumped the request package from 2.65.0 to 2.67.0. I get this error:

./web/dist/server.js:153022
    module.exports = function() { throw new Error("define cannot be used indirect"); };

Error: define cannot be used indirect

webpack:///(webpack)/buildin/amd-define.js?:1
module.exports = function() { throw new Error("define cannot be used indirect"); };

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 2
  • Comments: 18 (3 by maintainers)

Commits related to this issue

Most upvoted comments

The workaround mentioned by @manumax worked for me without having to downgrade request module to 2.65.0. i.e.

module: {
    noParse: /node_modules\/json-schema\/lib\/validate\.js/
}

$ npm install --save request@2.65.0 fixed for me as well.

$ npm install --save request@2.65.0 fixed it for me. I’m using request-promise and node 5.3.0 / npm 3.3.12.

I don’t know if it could help in any way, but a possible workaround is explained here: webpack/webpack#138 i.e. to add the following to your webpack config:

module: {
    noParse: /node_modules\/json-schema\/lib\/validate\.js/
}

As stated before I’m quite new to javascript and I don’t know if it has any implications, let me know otherwise.