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

JS bundle size increased #22

Closed
MarvinMiles opened this issue Jun 7, 2023 · 1 comment
Closed

JS bundle size increased #22

MarvinMiles opened this issue Jun 7, 2023 · 1 comment

Comments

@MarvinMiles
Copy link

Hello!
I'm using Vite for my small Vue App.

"tailwindcss-patch" and "unplugin-tailwindcss-mangle" packages installed as Dev Dependencies.

Here is my vite.config.js before adding utwm() plugin:

import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

export default defineConfig({
  plugins: [
    vue(),
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url)),
    },
  },
  build: {
    target: 'es2015',
    },
  },
})

Output:
225.39 kB │ gzip: 74.91 kB

With utwm() plugin:
316.63 kB │ gzip: 84.25 kB

After some investigation, I found that the bundle contains white spaces. Looks like Vite bypassing minification process. Or, most probably, utwm plugin rewrites output source code, reversing minification.

Is this expected behavior?

Hard-coded build.minify: 'esbuild' option had no effect. Is there a simple solution for this?
Thank you.

sonofmagic added a commit that referenced this issue Jun 7, 2023
@sonofmagic
Copy link
Owner

sonofmagic commented Jun 7, 2023

This issue has been solved in ^1.2.3.

Now When process.env.NODE_ENV === 'production', Then plugin will minify js by default.

or you can pass jsHandlerOptions to unplugin-tailwindcss-mangle to control this behaviour:

utwm({
      jsHandlerOptions: {
        minified: false / true
      }
})

sonofmagic added a commit that referenced this issue Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants