tradle / serverless-iot-local

MIT License
14 stars 7 forks source link

Webpack issue #7

Closed skrobek closed 5 years ago

skrobek commented 6 years ago

Hi!

I wanted to use your plugin to speed up my development process. Seems that server is running upi and I can send data via MQTT/Websockets. Unfourtunatley I have a problem with handlers written in ES6, looks like they are not compiled: SyntaxError: Unexpected token import - so the syntax is wrong. I'm using serverless-offline and serverless-webpack to run project and all other plugins like serverless-offline-sns are working. Any ideas?

mvayngrib commented 6 years ago

@skrobek sorry, not sure off the top of my head. Looking at the serverless-offline docs, I see they recommend to put serverless-offline last. Can you make sure that serverless-offline and serverless-iot-local come last and see if that helps?

skrobek commented 6 years ago

@mvayngrib Thanks for the reply. I've changed two things which solved the problem: 1) Plugins order

  - serverless-webpack
  - serverless-dynamodb-local
  - serverless-offline-sns
  - serverless-iot-local
  - serverless-offline

2) serverless-offline additional config

custom:
  serverless-offline:
    babelOptions:
      presets: ["es2015", "stage-3"]

You can close the issue and maybe it will help others in the future :-)

mvayngrib commented 6 years ago

@skrobek awesome, thanks for figuring that out! Was number 1 supposed to have a diff? They look the same to me

skrobek commented 6 years ago

@mvayngrib Sorry mistake in copy/paste. The most important was to use correct order of plugins and add presets to the serverless-offline plugin.