Skip to content
This repository was archived by the owner on Sep 8, 2021. It is now read-only.

Commit 7a828ea

Browse files
committed
add webpack additional config option
1 parent 83dd8d1 commit 7a828ea

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

index.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ module.exports = (api, projectOptions) => {
66
const {build, serve} = api.service.commands;
77
const buildFn = build.fn;
88
const serveFn = serve.fn;
9+
const webpackConfig = projectOptions.pluginOptions && projectOptions.pluginOptions.netlify && projectOptions.pluginOptions.netlify.webpackConfig;
910

1011
build.fn = (...args) => {
1112
return buildFn(...args).then((res) => {
1213
return lambdaBuild
13-
.run("src/lambda")
14+
.run("src/lambda", webpackConfig)
1415
.then(function(stats) {
1516
console.log(stats.toString({ color: true }))
1617
return res
@@ -34,7 +35,7 @@ module.exports = (api, projectOptions) => {
3435
}
3536
}
3637

37-
const forked = fork(path.join(__dirname, 'serve.js'))
38+
const forked = fork(path.join(__dirname, 'serve.js'), webpackConfig ? [webpackConfig] : null)
3839
return serveFn(...args)
3940
}
4041
}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
},
99
"author": "Netlify",
1010
"license": "MIT",
11+
"repository": "netlify/vue-cli-plugin-netlify-lambda",
1112
"dependencies": {
1213
"netlify-lambda": "1.0.0-babel-7-beta"
1314
}

serve.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ const serve = require("netlify-lambda/lib/serve");
22
const build = require("netlify-lambda/lib/build");
33

44
const server = serve.listen(9000)
5-
build.watch("src/lambda", null, function(err, stats) {
5+
const [, , webpackConfig] = process.argv;
6+
build.watch("src/lambda", webpackConfig, function(err, stats) {
67
if (err) {
78
console.error(err);
89
return;

0 commit comments

Comments
 (0)