https://github.com/8eecf0d2/webpack-netlify-lambda-plugin
Webpack helpers for Netlify Lambda
https://github.com/8eecf0d2/webpack-netlify-lambda-plugin
netlify netlify-functions netlify-lambda webpack-plugin
Last synced: 9 months ago
JSON representation
Webpack helpers for Netlify Lambda
- Host: GitHub
- URL: https://github.com/8eecf0d2/webpack-netlify-lambda-plugin
- Owner: 8eecf0d2
- Created: 2018-10-10T19:52:46.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-10T19:54:25.000Z (about 7 years ago)
- Last Synced: 2025-02-28T16:57:05.722Z (10 months ago)
- Topics: netlify, netlify-functions, netlify-lambda, webpack-plugin
- Language: JavaScript
- Size: 1000 Bytes
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Webpack Netlify Lambda Plugin
Small helper library to build Netlify Lambda compatible javascript
### config()
The simplest usage is with the `config()` method.
You can pass in an object with `srcdir`, `files`, `outdir` and `override` props - they do what you'd expect.
##### Input
```js
const webpackNetlifyLambdaPlugin = require("webpack-netlify-lambda-plugin");
const webpackConfig = webpackNetlifyLambdaPlugin.config({
outdir: "./build",
srcdir: "./src/main/",
files: [
"foo-func.js",
"bar-func.js",
"nested/qak-func.js",
],
override: {
plugins: [ ... ]
}
});
module.exports = webpackConfig;
```
##### Output
```js
{
target: "node",
mode: "development",
entry: {
"foo-func": "./src/main/foo-func.js",
"bar-func": "./src/main/bar-func.js",
"nested-qak-func": "./src/main/nested/qak-func.js"
},
resolve: { extentions: [ ".js" ] },
plugins: [ ... ],
output: {
path: "./build",
filename: "[name].js",
libraryTarget: "commonjs"
}
}
```
You can write your own webpack config and just use this plugin for the annoying things like formatting `config.entry` and `config.output`.
### entry()
```js
const webpackNetlifyLambdaPlugin = require("webpack-netlify-lambda-plugin");
module.exports = {
entry: webpackNetlifyLambdaPlugin.entry("./src/main/", [
"foo-func.js",
"bar-func.js",
"nested/qak-func.js",
]),
...
};
```
### output()
```js
const webpackNetlifyLambdaPlugin = require("webpack-netlify-lambda-plugin");
module.exports = {
output: webpackNetlifyLambdaPlugin.output("./build"),
...
};
```