Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minify support #46

Closed
danielroe opened this issue Feb 1, 2022 · 4 comments · Fixed by #285
Closed

minify support #46

danielroe opened this issue Feb 1, 2022 · 4 comments · Fixed by #285
Assignees
Labels
enhancement New feature or request

Comments

@danielroe
Copy link
Member

Maybe we can support min flag for unbuild and unify tooling?

see nuxt-modules/color-mode#118 (comment)

@danielroe danielroe added the enhancement New feature or request label Feb 1, 2022
@seanghay
Copy link

Is there any workaround?

@fwouts
Copy link

fwouts commented Jul 6, 2022

@seanghay I found this config seemed to work:

  rollup: {
    esbuild: {
      minify: true,
    },
  },

@xieyezi
Copy link

xieyezi commented Sep 6, 2022

@pi0
I also have this problem, and my unbuild config this:

import { defineBuildConfig } from "unbuild";

export default defineBuildConfig({
  entries: ["./index"],
  declaration: true,
  clean: true,
  failOnWarn: false,
  rollup: {
    emitCJS: true,
    esbuild: {
      minify: true
    }
  }
});

But after pnpm build , I get this error:

Error building E:/project/changan-incall/packages/microApp: Error: Transform failed with 1 error:
<stdin>:1:10: ERROR: Expected ";" but found "EnterMicroAppParams"
Error: Transform failed with 1 error:
<stdin>:1:10: ERROR: Expected ";" but found "EnterMicroAppParams"
    at failureErrorWithLog (E:\project\changan-incall\node_modules\.pnpm\esbuild@0.15.6\node_modules\esbuild\lib\main.js:1624:15)
    at E:\project\changan-incall\node_modules\.pnpm\esbuild@0.15.6\node_modules\esbuild\lib\main.js:1413:29
    at E:\project\changan-incall\node_modules\.pnpm\esbuild@0.15.6\node_modules\esbuild\lib\main.js:678:9
    at handleIncomingPacket (E:\project\changan-incall\node_modules\.pnpm\esbuild@0.15.6\node_modules\esbuild\lib\main.js:775:9)
    at Socket.readFromStdout (E:\project\changan-incall\node_modules\.pnpm\esbuild@0.15.6\node_modules\esbuild\lib\main.js:644:7)
    at Socket.emit (node:events:526:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at Pipe.onStreamRead (node:internal/stream_base_commons:190:23) {
  errors: [
    {
      detail: undefined,
      id: '',
      location: [Object],
      notes: [],
      pluginName: '',
      text: 'Expected ";" but found "EnterMicroAppParams"'
    }
  ],
  warnings: [],
  code: 'PLUGIN_ERROR',
  plugin: 'esbuild',
  hook: 'renderChunk'
}

How Can I resolve this ?

@SukkaW
Copy link
Contributor

SukkaW commented Apr 13, 2023

But after pnpm build , I get this error:

I have encountered this error as well. It may be caused by esbuild trying to minify a ts/d.ts file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants