dougmoscrop / serverless-plugin-include-dependencies

MIT License
184 stars 40 forks source link

Fails with babel-runtime #3

Closed otbe closed 7 years ago

otbe commented 7 years ago

Hi,

I use "serverless-plugin-include-dependencies" in conjunction with a babel project. So I include babel-polyfill which requires babel-runtime.

The plugin fails at packaging with this error:

Error: Cannot find module 'babel-runtime' from '...project/node_modules/ba
bel-polyfill'
    at Function.module.exports [as sync] (...project/node_modules/resolve/
lib/sync.js:36:11)
    at Object.keys.forEach.dependency (...project/node_modules/serverless-
plugin-include-dependencies/get-dependency-list.js:60:29)
....

I think the problem is that babel-runtime is not resolvable via resolve because of no "main" property. So this line will raise the error above.

Whats the correct behavior?

Thank you!

Edit: As of now I use babel-preset-env and all my problems went away :)

dougmoscrop commented 7 years ago

I will take a look, thanks for the info!

aymericbeaumet commented 7 years ago

Faced the same issue, and couldn't manage to force it through include. Any input?

Maybe this could be configurable with a flag.

dougmoscrop commented 7 years ago

I will take a look I'm just on vacation right now. Back on Monday and it's the first thing I plan to look at. Otherwise happy for a PR that adds some kind of override or whatever.

On Fri, Jan 27, 2017, 11:56 AM Aymeric Beaumet notifications@github.com wrote:

Faced the same issue, and couldn't manage to force it through include. Any input?

Maybe this could be configurable with a flag.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/dougmoscrop/serverless-plugin-include-dependencies/issues/3#issuecomment-275714653, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjzFIAMgzzMiGfxEXsODeQvgyBuqJ6bks5rWiFOgaJpZM4LeESQ .

aymericbeaumet commented 7 years ago

No worries. Just found about the problem, will try to find some time to dig it.

nbransby commented 7 years ago

Any luck with this?

jaypeng2015 commented 7 years ago

Faced the same issue with babel-register:

Cannot find module 'babel-runtime' from .../node_modules/babel-register'

Node: v4.3.2

"dependencies": {
    ...
    "babel-preset-env": "^1.1.8",
    "babel-register": "^6.18.0",
    ...
  }
dougmoscrop commented 7 years ago

Yes this needs some browserify-esque import directive. I've been swamped I promise I will look at it soon

On Mon, Feb 6, 2017, 6:39 PM Jingwei Peng notifications@github.com wrote:

Faced the same issue with babel-register:

Cannot find module 'babel-runtime' from .../node_modules/babel-register'

Node: v4.3.2

"dependencies": { ... "babel-preset-env": "^1.1.8", "babel-register": "^6.18.0", ... }

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/dougmoscrop/serverless-plugin-include-dependencies/issues/3#issuecomment-277850626, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjzFOPp_nbaFVnA1P9VjiCYWoIzUZfcks5rZ68ogaJpZM4LeESQ .

dougmoscrop commented 7 years ago

I've published v1.2.2 that should fix this and requires no additional configuration.

b04zdotcom commented 7 years ago

Unfortunately I'm still getting the exact same error with version 2.0.0.

dougmoscrop commented 7 years ago

I thought I wrote a test specifically for babel runtime.. stack trace is the same above?

On Mon, Mar 13, 2017, 11:24 AM Boaz de Jong notifications@github.com wrote:

Unfortunately I'm still getting the exact same error with version 2.0.0.

— You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub https://github.com/dougmoscrop/serverless-plugin-include-dependencies/issues/3#issuecomment-286141091, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjzFMcjkFqInQmTMAFiRgq_lc3eUOlrks5rlV--gaJpZM4LeESQ .

b04zdotcom commented 7 years ago

I'm currently getting this error when running my lambda, but was getting it earlier about babel-runtime. Now that I think of it, this might have been before updating the plugin. Sorry about that. Still facing this though but can open a new issue.

Unable to import module 'build/handler': Error
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/var/task/node_modules/gql-merge/dist/index.js:9:16)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)

Without the plugin everything works as expected.

dougmoscrop commented 7 years ago

I've made some changes can you try to repro with 2.1?

b04zdotcom commented 7 years ago

Not sure what project I was using this on. But I'll try to figure it out tomorrow.

dougmoscrop commented 7 years ago

We're using this library in a dozen or so projects with varying dependencies and I'm pretty sure I fixed this -- so I am going to close for housekeeping, but please re-open if you can still get it to happen. Thanks!