Closed loatheb closed 7 years ago
I'm confused; the vm part of hypernova is server code; webpack is for browser code. Why are you bundling the server part?
I just want to bundle both server code into one file.that makes me easier to deploy.
Typically that's done by using tar
and deploying an archive, and extracting it on the server. Bundling up server code is not what I'd consider a supported use case, and it's not the purpose of webpack.
Thanks for replying.I think you're right.
But I want to deploy these code to the AWS Lambda Function. So that, If I don't bundle both file, I have to deploy the node_modules
folder on the server.The file size is very large, It makes me uncomfortable every time I deploy it.
So that I use webpack
to bundle it, to reduce the size of the file at each deploy.
Run npm prune --production
before deploying it; also, you could use rsync
over scp
so that you're only copying changes.
Thank you. Much useful.
when I'm using webpack to bundle the project code into one file. I find the code
require
in src/module will be compiled into__webpack_require__
. so that I can't load the native module from node in thevm
context.code in
lib/Module.js
my project code use
createVM
, some sample code like this:As a result. the code in
Module.js
will be bundled by webpack like thisso that. if I require some native module in
vm.run
. It cannot resolved by webpackif I change the code in the
src/Module.js
then build and bundle.The result workd well.Any suggestion?