Common-voice: Build system should automatically import external libraries from node_modules

Created on 9 Oct 2017  路  3Comments  路  Source: mozilla/common-voice

Right now, I think the external libraries are manually added at vendor/ folder and prepended into the final JS bundle during gulp build.

Because of this, I had quite some time troubleshooting how to integrate a new library into this project. (still not successful btw) Could the build system be improved such that external libraries are automatically imported from node_modules during building process?

I think something could be modified at the Typescript gulp build process to support this (because I happen to have a side project in TypeScript that could do this, e.g. https://github.com/kenrick95/c4/commit/84d717a4067b26d60d361718ee572bdc48dac25a is a small commit to add a Polyfill library to the app)

help wanted

All 3 comments

great idea! this way, we could also include things like minified or unminified sources based on a build flag, source maps, etc.

right now I think we have google-analytics, preact, and almond.js as our vendor libraries. if we could copy them over from node_modules rather than check them directly in, that would be ideal

For the web part, webpack can do this (and is a currently very popular solution for it). I鈥檓 not sure if it works for our backend too, but it might.

I鈥檒l see if I can investigate a bit this weekend, und less someone else already knows more or gets around to it before me

See proof-of-concept for switching to Webpack in #508.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nevik picture nevik  路  5Comments

mbebenita picture mbebenita  路  3Comments

mbransn picture mbransn  路  5Comments

kenrick95 picture kenrick95  路  4Comments

selimsumlu picture selimsumlu  路  3Comments