I have built 3 separate npm modules with webpack. They all have a dependency on angular because I have the line:
var angular = require('angular');
in the angular module definitions for each npm module.
One of the modules has a dependency on the other 2:
var angular = require('angular');
var ngModule = angular.module('topModule', [
require('dependency1'),
require('dependency2')
]);
I believe the reason I'm getting the tried to load angular more than once error is because Angular has been included in all 3 of the bundles built by webpack.
I understand that I could have configured webpack to put angular in a separate file (e.g. vendor.js), but I thought that when I built the top level file, it would see that Angular was already included by the other 2 modules and wouldn't add it again.
How do I use `require('angular')' in all of the modules, but only have it included once in the top level module?
angularmodule copies, this would cause a thing like that. If semver restrictions are compatible,npm dedupemay help. You may examine the build with github.com/webpack/webpack/issues/690 Without knowing your build, nothing more specific can be suggested at this point.