Skip to content

Transforming minified file leads to error #1995

Answered by kdy1
JoviDeCroock asked this question in Q&A
Discussion options

You must be logged in to vote

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 jsc.minify, not minify.

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@JoviDeCroock
Comment options

@JoviDeCroock
Comment options

@kdy1
Comment options

@kdy1
Comment options

@JoviDeCroock
Comment options

Answer selected by JoviDeCroock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants