serverless-esbuild
Advanced tools
Comparing version
@@ -174,3 +174,6 @@ "use strict"; | ||
return Promise.all(this.rootFileNames.map(({ entry, func, functionAlias }) => __awaiter(this, void 0, void 0, function* () { | ||
const config = Object.assign(Object.assign({}, this.buildOptions), { external: [...this.buildOptions.external, ...this.buildOptions.exclude], entryPoints: [entry], outdir: path.join(this.buildDirPath, path.dirname(entry)), platform: 'node', incremental, plugins: this.plugins }); | ||
const config = Object.assign(Object.assign({}, this.buildOptions), { external: [ | ||
...this.buildOptions.external, | ||
...(this.buildOptions.exclude === '*' || this.buildOptions.exclude.includes('*') ? [] : this.buildOptions.exclude) | ||
], entryPoints: [entry], outdir: path.join(this.buildDirPath, path.dirname(entry)), platform: 'node', incremental, plugins: this.plugins }); | ||
// esbuild v0.7.0 introduced config options validation, so I have to delete plugin specific options from esbuild config. | ||
@@ -177,0 +180,0 @@ delete config['exclude']; |
@@ -134,3 +134,7 @@ "use strict"; | ||
} | ||
const externals = (0, ramda_1.without)(this.buildOptions.exclude, this.buildOptions.external); | ||
let externals = []; | ||
// get the list of externals only if exclude is not set to * | ||
if (this.buildOptions.exclude !== '*' && !this.buildOptions.exclude.includes('*')) { | ||
externals = (0, ramda_1.without)(this.buildOptions.exclude, this.buildOptions.external); | ||
} | ||
if (!externals || !externals.length) { | ||
@@ -137,0 +141,0 @@ return; |
@@ -88,4 +88,7 @@ "use strict"; | ||
const bundlePathList = buildResults.map((b) => b.bundlePath); | ||
// get a list of externals | ||
const externals = (0, ramda_1.without)(this.buildOptions.exclude, this.buildOptions.external); | ||
let externals = []; | ||
// get the list of externals to include only if exclude is not set to * | ||
if (this.buildOptions.exclude !== '*' && !this.buildOptions.exclude.includes('*')) { | ||
externals = (0, ramda_1.without)(this.buildOptions.exclude, this.buildOptions.external); | ||
} | ||
const hasExternals = !!(externals === null || externals === void 0 ? void 0 : externals.length); | ||
@@ -92,0 +95,0 @@ // get a tree of all production dependencies |
{ | ||
"name": "serverless-esbuild", | ||
"description": "Serverless plugin for zero-config JavaScript and TypeScript code bundling using extremely fast esbuild", | ||
"version": "1.18.0", | ||
"version": "1.18.1", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "author": "Victor Korzunin", |
@@ -48,3 +48,3 @@ # 💨 serverless-esbuild | ||
Check [esbuild](https://github.com/evanw/esbuild#command-line-usage) documentation for the full list of available options. Note that some options like `entryPoints` or `outdir` cannot be overwritten. | ||
The package specified in the `exclude` option is passed to esbuild as `external`, but it is not included in the function bundle either. The default value for this option is `['aws-sdk']`. | ||
The package specified in the `exclude` option is passed to esbuild as `external`, but it is not included in the function bundle either. The default value for this option is `['aws-sdk']`. You can set `exclude` to `*` to disable packaging `node_modules`. | ||
@@ -51,0 +51,0 @@ See [example folder](examples) for a minimal example. |
72675
0.82%1223
0.74%