@rpcbase/vite 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +16 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -9,13 +9,23 @@ import {
9
9
 
10
10
  import react from "@vitejs/plugin-react-swc"
11
11
  import { createHtmlPlugin } from "vite-plugin-html"
12
- // @ts-ignore
13
- import tailwindcss from "@tailwindcss/vite"
14
12
 
15
13
  const ALLOWED_DEV_ENV = ["NODE_ENV", "APP_NAME", "DB_NAME"]
16
14
 
17
15
  const isProduction = process.env.NODE_ENV === "production"
18
16
 
17
+ // https://github.com/vbenjs/vite-plugin-html?tab=readme-ov-file#minifyoptions
18
+ const htmlMinifyOptions = {
19
+ collapseWhitespace: true,
20
+ keepClosingSlash: true,
21
+ removeComments: false,
22
+ removeRedundantAttributes: true,
23
+ removeScriptTypeAttributes: true,
24
+ removeStyleLinkTypeAttributes: true,
25
+ useShortDoctype: true,
26
+ minifyCSS: true,
27
+ }
28
+
19
29
 
20
30
  export const resolveAliases = {
21
31
  "@/api": path.resolve(process.cwd(), "./src/api/"),
@@ -53,7 +63,10 @@ const getBaseConfig = ({ command, mode, isSsrBuild, isPreview }) => {
53
63
 
54
64
  return {
55
65
  clearScreen: false,
56
- plugins: [react(), tailwindcss(), createHtmlPlugin()],
66
+ plugins: [react(), createHtmlPlugin({
67
+ // IMPORTANT: minify removes comments by default, which are used by the app ssr
68
+ minify: htmlMinifyOptions,
69
+ })],
57
70
  define: {
58
71
  "__vite_env__": {
59
72
  ...env,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/vite",
3
- "version": "0.11.0",
3
+ "version": "0.13.0",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "scripts": {