Pass code as buffer to swc minify (#29009)

This should fix this: https://github.com/vercel/next.js/pull/28883/checks?check_run_id=3560578176#step:4:353



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes
This commit is contained in:
Maia Teegarden 2021-09-10 17:57:01 -07:00 committed by GitHub
parent 1f99c3009f
commit 0d0f34ba18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -68,11 +68,11 @@ function toBuffer(t) {
} }
export async function minify(src, opts) { export async function minify(src, opts) {
return bindings.minify(src, toBuffer(opts ?? {})) return bindings.minify(toBuffer(src), toBuffer(opts ?? {}))
} }
export function minifySync(src, opts) { export function minifySync(src, opts) {
return bindings.minifySync(src, toBuffer(opts ?? {})) return bindings.minifySync(toBuffer(src), toBuffer(opts ?? {}))
} }
module.exports.transform = transform module.exports.transform = transform