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

Cannot exclude lodash when use it as an external #10111

Closed
kingller opened this issue Dec 12, 2019 · 3 comments
Closed

Cannot exclude lodash when use it as an external #10111

kingller opened this issue Dec 12, 2019 · 3 comments
Labels

Comments

@kingller
Copy link

kingller commented Dec 12, 2019

Bug report

What is the current behavior?

I set the lodash to externals, but it still left some code in my package file.
image

webpack.config.js

{
   externals: {
    lodash: '_'
  }
}

If I add noParse to webpack.config.js

{
  module: {
    noParse: /lodash/,
  }
}

Then an error happens,

Uncaught ReferenceError: require is not defined

If the current behavior is a bug, please provide the steps to reproduce.

What is the expected behavior?
lodash code should not be in my file.

Other relevant information:
webpack version: 4.41.2
Node.js version: 10.16.3
Operating System: ios
Additional tools: vs code

@sokra
Copy link
Member

sokra commented Dec 15, 2019

{
externals: {
lodash: '_'
}
}

this matches require("lodash") but doesn't work for e.g. require("lodash/throttle"). Use a function to match all of them.

@webpack-bot
Copy link
Contributor

This issue had no activity for at least three months.

It's subject to automatic issue closing if there is no activity in the next 15 days.

@alexander-akait
Copy link
Member

Closing due to inactivity. Please test with latest version and feel free to reopen if still regressions. Thanks!

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

No branches or pull requests

4 participants