question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add an option to auto-detect third-party packages

See original GitHub issue

When using CommonsChunkPlugin, each third-party dependency must be added to webpack.config.js by hand. A plugin with the nameAbstractAwayDependencies could be written to provide the functionality of abstracting away npm dependencies from the code into a separate file. (By default, vendor-[hash].js.)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
sokracommented, Jun 10, 2016

This automatically selects modules based on the path:

new webpack.optimize.CommonsChunkPlugin({
  name: 'vendor',
  minChunks: function(module) {
    return module.resource && /node_modules/.test(module.resource)
  }
}),

But specifying dependencies manually has the advantage that the vendor chunk changes less often.

2reactions
Fouzyyyycommented, Apr 2, 2017

Hi all, hi @kripod ,

There is an other way to specify implicitly your prod dependencies, here is the trick:

  • Go to your webpack.config.js file, and add the following module import statement: const prodDependencies = require('path to your package.json file');

  • now you need to update your entry points: entry: { vendor: Object.keys(prodDependencies.dependencies) }

Make sure the name you choose for this entry is the same you use for your CommonsChunkPlugin configuration so that you can move your redendent prod dependencies to that file as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add and assign Win32 apps to Microsoft Intune
Learn how to add, assign, and manage Win32 apps with Microsoft ... This type of app is typically written in-house or by a...
Read more >
Automating Third-Party Application Creation and Patching in ...
Join Justin Chalfant from Patch My PC for a 100% live demo showing how easy extending SCCM and Intune to automatically create, update...
Read more >
Spring Component Scanning - Baeldung
With Spring, we use the @ComponentScan annotation along with the @Configuration annotation to specify the packages that we want to be scanned. @ ......
Read more >
MQTT - Home Assistant
To enable a secure the broker certificate should be validated. If your broker uses a trusted certificate then choose auto . This will...
Read more >
Buildpacks | Heroku Dev Center
For a list of known third-party buildpacks, see Using a third-party ... the automatic setting of the detected buildpack on your application.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found