digitalmaas / serverless-plugin-browserifier

Reduce the size and speed up your Node.js based lambda's using browserify.
Other
27 stars 4 forks source link

data.functionObject.artifact sometimes not found #2

Closed RobBrazier closed 7 years ago

RobBrazier commented 7 years ago

I just started using this plugin, switched over from webpack and I really like it, however after getting the plugin working and packaging properly the first time, the build now fails with the following error: https://gist.github.com/RobBrazier/010880575cac41b57c0311eb55ed7aae

I'm able to resolve this by changing bundle.js#87 and bundle.js#90 from data.functionObject.artifact to data.functionObject.package.artifact, however I'm not sure if I'm doing something wrong here?

I'm happy to raise a PR to check both objects if you want.

RobBrazier commented 7 years ago

okay, it looks like this is a change from serverless v1.17.0 to 1.18.0. I'll raise a pull request for this as other people are likely to hit this issue as well

nolde commented 7 years ago

Hi mate! Thanks for the pull request!

You are right: there was an issue created in serverless 1.12.0 that was now fixed in 1.18.0.

So we can even go further than your PR: I had to basically fool serverless to create an empty package and then overwrite it with a new one afterwards. Now, it should be safe to create the package straight away and serverless should recognise it.

I will also merge another PR that turns browserify into a peerDependency, allowing users to change version.

I will do it tomorrow!

Thanks again!

nolde commented 7 years ago

Just to let you know: I have published version 1.0.5 just now. I've kept the prepare+bundle format to keep backwards compatible.