Compile multiple node.js files into one

702 Views Asked by At

I am writing code for webtask.io and it seems as if I can only upload one file to run. I would like to organize my code into multiple files with different modules but then have them be compiled into one for upload. I have tried gulp with gulp-concat but this just concatenates the files without preserving any execution logic. I would assume there is a simple way to do this.

2

There are 2 best solutions below

0
On

Just set the --bundle argument.

$ wt create index.js --bundle
0
On

Webpack works well, especially with the webpack-node-externals' package: https://www.npmjs.com/package/webpack-node-externals.