Hugo

Avoid Module Dependency Duplication

Hi,

Hoping to get an idea of how to keep from duplicating module dependencies.

Let’s say I have to modules that do similar things and require the some of the same libraries and use es6. Since they have to use es6, webpack does my transforming and stores transpiled js in the assets folder.

To make my life easier I’m using Hugo Pipes to bundle all js from /assets/js/.

/themes/
|- mod-1/
|-- assets/
|--- js/
|---- mod-1-transpiled.js
|-- src/
|--- mod-1-es6.js  //imports modules from library.js
|--- library.js
|- mod-2/
|-- assets/
|--- js/
|---- mod-2-transpiled.js
|-- src/
|--- mod-2-es6.js  //imports modules from library.js
|--- library.js

Any ideas on how to avoid exporting the modules from library.js twice?