1

Is there a way to specify a fallback for webpack external, for example if I can't find angular then try to search for it in your node_modules?

KisaneNeko
  • 96
  • 6

1 Answers1

0

You can reference parts 2 of the answer to this Webpack question.

You can use the provide plugin and set an alias for the global. As stated:

Most legacy modules rely on the presence of specific globals, like jQuery plugins do on $ or jQuery. In this scenario you can configure webpack, to prepend var $ = require("jquery") everytime it encounters the global $ identifier.

The angular global will be treated the same way. Therefore if you don't have angular in node modules but loaded via external script, Webpack will allow you to use it the same way as if it was living in your node modules.

Community
  • 1
  • 1
Sean Larkin
  • 5,533
  • 23
  • 40