mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Docs: add section on (preventing) bundling with esbuild
This commit is contained in:
parent
ac18bbbc7c
commit
72fd8abe2c
@ -213,9 +213,11 @@ SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install --arch=x64 --platform=linux sharp
|
||||
To get the best performance select the largest memory available.
|
||||
A 1536 MB function provides ~12x more CPU time than a 128 MB function.
|
||||
|
||||
## Webpack
|
||||
## Bundlers
|
||||
|
||||
Ensure sharp is added to the
|
||||
### webpack
|
||||
|
||||
Ensure sharp is excluded from bundling via the
|
||||
[externals](https://webpack.js.org/configuration/externals/)
|
||||
configuration.
|
||||
|
||||
@ -225,6 +227,25 @@ externals: {
|
||||
}
|
||||
```
|
||||
|
||||
### esbuild
|
||||
|
||||
Ensure sharp is excluded from bundling via the
|
||||
[external](https://esbuild.github.io/api/#external)
|
||||
configuration.
|
||||
|
||||
```js
|
||||
buildSync({
|
||||
entryPoints: ['app.js'],
|
||||
bundle: true,
|
||||
platform: 'node',
|
||||
external: ['sharp'],
|
||||
})
|
||||
```
|
||||
|
||||
```sh
|
||||
esbuild app.js --bundle --platform=node --external:sharp
|
||||
```
|
||||
|
||||
## Worker threads
|
||||
|
||||
The main thread must call `require('sharp')`
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user