-
Notifications
You must be signed in to change notification settings - Fork 40
function replace all previous output of webpack #34
Comments
Ran to this issue my workaround was to override the plugins and use plugins/offline-scheduler.js
And use this instead on serverless.yml
|
I'm having trouble with this too, I tried the previous workaround, but it complains about the folder for the function not existing
If I look at my .webpack folder i can see that the code build with serverless offline start is different and keeps the structure /.webpack/service/nameOfFunction/. is it possible to change that somewhere so both generated structures match? |
Ah, I spent about 5 hours trying to figure this out, working on one function successfully but then when I went to try my other function, it would |
The following was modified from @melvinmaron05 because it was no longer working for me. Make sure the plugin ( Updated Code: /**
* Following code was taken from melvinmaron05 and modified
* To Fix: https://github.com/ajmath/serverless-offline-scheduler/issues/34
* From Comment: https://github.com/ajmath/serverless-offline-scheduler/issues/34#issuecomment-544941382
*/
const Scheduler = require("serverless-offline-scheduler/lib/scheduler");
const {execSync} = require('child_process');
Scheduler.prototype._executeFunction = function (fName, fInput) {
const args = ["npx", "serverless", "invoke", "local", "--function", fName, "--no-build"]
if (fInput) {
args.push("--data", JSON.stringify(JSON.stringify(fInput))); // Stringify 2x to escape " when putting json as string in console command.
}
for (const { name, value } of this._getSlsInvokeOptions()) {
args.push(`--${name}`, value);
}
return execSync(args.join(' '), { cwd: "./", stdio: "inherit" });
}
class OfflineScheduler {
constructor(serverless) {
this.serverless = serverless;
this.scheduler = new Scheduler(serverless);
this.commands = {
schedule: {
usage: "Run scheduled lambdas locally",
lifecycleEvents: [
"run"
]
}
};
this.hooks = {
"before:offline:start:init": () => this.scheduler.run()
};
}
}
module.exports = OfflineScheduler; As before, add the custom plugin file to the plugins list in plugins:
- serverless-webpack
- ./plugins/offline-scheduler |
Good day! If function invokes, it replaces all output of webpack. In this case, I can't use anything from serverless offline. Could somebody provide me information, how I can configure webpack to solve this issue?
The text was updated successfully, but these errors were encountered: