Serverless-webpack: watch with serverless offline

Created on 10 Apr 2020  路  13Comments  路  Source: serverless-heaven/serverless-webpack

This is a Question

Description

When using this plugin with Serverless offline, it transpiles as expected but is it possible to trigger a retranspile when a change is detected? Currently have to restart the serverless offline wrapper.

Thanks!

Most helpful comment

serverless-offline:
  useChildProcesses: true

All 13 comments

I've been having trouble with this too. I use nodemon as a workaround. Here are the scripts:

"serve": "sls offline -P 4000",
"serve:watch": "nodemon -e js,ts,jsx,tsx -x yarn run serve",

This used to work for me, but after updating my package version it stopped working.

This used to work for me, but after updating my package version it stopped working.

webpack used to watch and rebuild automatically?

Serverless offline with serverless-webpack did have the watch thing work, yeah

Do you know which version broke watch?

serverless-offline:
  useChildProcesses: true

facing the same issue. Using nodemon as a workaround works fine. But it is not as fast as serverless-webpack

Published a little module that I was using internally to solve this, since asking the original question - https://www.npmjs.com/package/serverless-offline-multi but would be great to work out how/when the webpack watch broke

Also wondering how to do this

webpack-watch is fixed by this: working on macOS Catalina.
Update serverless.yml to add custom attribute like this:

custom:
  serverless-offline:
    useChildProcesses: true

@AshUK @haroonKhan-10p Worth noting that these are not fixes, more so workarounds. They massively degrade performance, especially for larger projects.

@haroonKhan-10p that unfortunately didn't do anything for me.

The issue for me is that webpack does watch and transpile correctly, but serverless offline uses cached files and not the new ones. I think the issue lies with the serverless-offline plugin

I think we will have to dig into the plugin and see if there's some way to fix it. I looked into it yesterday and I don't really see the problem, but I'll keep digging.

Also see this related issue: https://github.com/dherault/serverless-offline/issues/931

And this one: https://github.com/dherault/serverless-offline/issues/864

And this one: dherault/serverless-offline#864
The above is what broke it. This was a change introduced in serverless-offline 6.0.0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rvaidya picture rvaidya  路  4Comments

serverlesspolska picture serverlesspolska  路  4Comments

bebbi picture bebbi  路  3Comments

wooooooak picture wooooooak  路  5Comments

tommedema picture tommedema  路  4Comments