How do I bundle a JavaScript module with npm dependencies to have 0 dependencies

混江龙づ霸主 提交于 2021-02-11 13:51:00

问题


I have a module module.js which itself has dependencies. Some dependencies are local via require('./relative/import/path.js') while other dependencies are from npm via require('npm/import/path.js').

My module has it's own exports via module.exports = { myfunc: myfunc }. Other JavaScript files need to require('./path/to/modules.js') so they can use myfunc.

How can I bundle together all the dependencies and ship my module as a stand-alone thing?

note: Browserify fails to allow me to export myfunc.

来源:https://stackoverflow.com/questions/56740359/how-do-i-bundle-a-javascript-module-with-npm-dependencies-to-have-0-dependencies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!