Transforming minified file leads to error #1995
Answered
by
kdy1
JoviDeCroock
asked this question in
Q&A
-
I made a small reproduction, generally when calling transform with the eventual goal of minifying it leads to a Rust error: https://codesandbox.io/s/modern-shape-3n0v3?file=/src/index.js Code in question: https://www.runpkg.com/?preact I know it isn't the intention to minify already minififed files but this is part of a larger bundle and it errors in the larger bundle as well |
Beta Was this translation helpful? Give feedback.
Answered by
kdy1
Aug 3, 2021
Replies: 1 comment 6 replies
-
You should do like var http = require("http");
var swc = require("@swc/core");
var fetch = require("node-fetch");
fetch("https://unpkg.com/preact")
.then((response) => response.text())
.then((code) => {
swc
.transform(code, {
jsc: {
target: "es2018",
parser: {
dynamicImport: true
},
minify: {
compress: true,
sourceMap: false,
ecma: 2018,
mangle: true,
safari10: true
}
},
minify: true
})
.then((result) => {
console.log(result);
})
.catch(console.error);
}); It's |
Beta Was this translation helpful? Give feedback.
6 replies
Answer selected by
JoviDeCroock
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You should do like
It's
jsc.minify
, notminify
.