-
Notifications
You must be signed in to change notification settings - Fork 2
Command Bundle
The bundle command will parse a netlify.toml
and then set the entry
and output
property within the provided Webpack configuration file before attemping compile the codebase.
If you have correctly specified options within the netlify.toml
you can run the bundle command without any arguments.
netlify-local bundle
To configure the bundle command you can use the following relevant options.
As an example, here's a basic netlify.toml
[build]
base = ""
publish = "dist/client"
functions = "dist/functions"
command = "yarn run build"
[plugins.local.webpack]
config = "webpack.js"
[plugins.local.functions]
config = "functions"
source = "src/functions/ts/"
files = [
"foo.ts",
"nested/bar.ts"
]
By parsing the build.functions
and plugin.local.functions
properties the bundle command is able to mutate the Webpack Configuration object with the following entry
and output
props.
{
entry: {
"foo": "src/lambda/ts/foo.ts",
"nested-bar": "src/lambda/ts/nested/bar.ts",
},
output: {
path: "dist/functions",
filename: "[name].js",
libraryTarget: "commonjs",
},
}
To easily support multi-compiler build environments the bundle command expects the target Webpack Configuration to have a name
property equaling "functions"
or you can specify a custom name with the plugins.local.functions.config
property.
There are no plans to provide a bare minimum webpack configuration so that user's do not need to write their own, doing so would open up a world of technical and support issues unrelated to this library - but if that's what you're looking for checkout netlify-lambda.