create-packer 1.24.33 → 1.24.34

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-packer",
3
- "version": "1.24.33",
3
+ "version": "1.24.34",
4
4
  "main": "index.js",
5
5
  "repository": "https://github.com/kevily/create-packer",
6
6
  "author": "1k <bug_zero@163.com>",
@@ -1,13 +1,13 @@
1
- <!DOCTYPE html>
1
+ <!doctype html>
2
2
  <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>Vite + React + TS</title>
8
- </head>
9
- <body>
10
- <div id="root"></div>
11
- <script type="module" src="main.tsx"></script>
12
- </body>
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Vite + React + TS</title>
8
+ </head>
9
+ <body>
10
+ <div id="root"></div>
11
+ <script type="module" src="/main.tsx"></script>
12
+ </body>
13
13
  </html>
@@ -7,6 +7,7 @@
7
7
  "prepare": "husky install",
8
8
  "dev": "vite",
9
9
  "build": "tsc --noEmit && vite build",
10
+ "build:analyse": "tsc --noEmit && vite build --mode analyse",
10
11
  "preview": "vite preview",
11
12
  "up:vite": "pnpm up vite @vitejs/* -L",
12
13
  "format": "prettier --write \"**/*.{ts,js,tsx,jsx,json,css,scss,less}\"",
@@ -57,6 +58,7 @@
57
58
  "postcss-import": "15.1.0",
58
59
  "postcss-nesting": "11.2.2",
59
60
  "prettier": "3.0.0",
61
+ "rollup-plugin-visualizer": "5.9.2",
60
62
  "stylelint": "15.7.0",
61
63
  "stylelint-config-standard": "33.0.0",
62
64
  "tailwindcss": "3.3.1",
@@ -3,6 +3,8 @@ import react from '@vitejs/plugin-react'
3
3
  import svgr from 'vite-plugin-svgr'
4
4
  import mockDevServer from 'vite-plugin-mock-dev-server'
5
5
  import checker from 'vite-plugin-checker'
6
+ import { visualizer } from 'rollup-plugin-visualizer'
7
+ import { includes } from 'lodash-es'
6
8
  import { createChunks } from './scripts'
7
9
 
8
10
  // https://vitejs.dev/config/
@@ -33,6 +35,10 @@ export default defineConfig(({ mode }) => {
33
35
  })
34
36
  ]
35
37
 
38
+ if (mode === 'analyse') {
39
+ plugins.push(visualizer({ open: true, sourcemap: true, brotliSize: true, gzipSize: true }))
40
+ }
41
+
36
42
  return {
37
43
  base: env.VITE_BASE_URL,
38
44
  plugins,
@@ -42,9 +48,10 @@ export default defineConfig(({ mode }) => {
42
48
  }
43
49
  },
44
50
  esbuild: {
45
- drop: mode === 'production' ? ['console', 'debugger'] : []
51
+ drop: includes(['production', 'analyse'], mode) ? ['console', 'debugger'] : []
46
52
  },
47
53
  build: {
54
+ sourcemap: mode === 'analyse',
48
55
  rollupOptions: {
49
56
  output: {
50
57
  manualChunks: createChunks({
@@ -11,6 +11,7 @@ node_modules
11
11
  dist
12
12
  dist-ssr
13
13
  *.local
14
+ stats.html
14
15
 
15
16
  # Editor directories and files
16
17
  .vscode/*
@@ -8,6 +8,7 @@
8
8
  "scripts": {
9
9
  "dev": "webpack serve --env mode=dev",
10
10
  "build": "webpack",
11
+ "build:analyzer": "webpack --env mode=analyzer",
11
12
  "up:vite": "pnpm up vite @vitejs/* -L",
12
13
  "format": "prettier --write \"**/*.{ts,js,tsx,jsx,json,css,scss,less}\"",
13
14
  "lint": "tsc --noEmit && eslint **/*.{tsx,ts,jsx,js} && stylelint **/*.{css,scss,less}",
@@ -71,6 +72,7 @@
71
72
  "stylelint-config-standard": "34.0.0",
72
73
  "typescript": "5.2.2",
73
74
  "webpack": "5.88.2",
75
+ "webpack-bundle-analyzer": "^4.9.1",
74
76
  "webpack-cli": "5.1.4",
75
77
  "webpack-dev-server": "4.15.1",
76
78
  "webpackbar": "5.0.2"
@@ -6,11 +6,14 @@ import HtmlWebpackPlugin from 'html-webpack-plugin'
6
6
  import MiniCssExtractPlugin from 'mini-css-extract-plugin'
7
7
  import EslintWebpackPlugin from 'eslint-webpack-plugin'
8
8
  import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'
9
+ import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
9
10
  import * as dotenv from 'dotenv'
10
11
  import { ROOT, OUTPUT, createCssLoader, createStyleLoader } from './webpack_config/index.mjs'
11
12
 
12
13
  function getEnvConfig(mode) {
13
- const envConfig = dotenv.config({ path: mode ? `.env.${mode}` : '.env' }).parsed
14
+ const envConfig = dotenv.config({
15
+ path: mode && mode !== 'analyzer' ? `.env.${mode}` : '.env'
16
+ }).parsed
14
17
  Object.keys(envConfig).forEach(k => {
15
18
  envConfig[k] = JSON.stringify(envConfig[k])
16
19
  })
@@ -107,7 +110,8 @@ export default function (env) {
107
110
  new MiniCssExtractPlugin({
108
111
  filename: env.WEBPACK_BUILD ? 'css/[name].[contenthash].css' : 'css/[name].css',
109
112
  chunkFilename: env.WEBPACK_BUILD ? 'css/[name].[contenthash].css' : 'css/[name].css'
110
- })
113
+ }),
114
+ env.mode === 'analyzer' && new BundleAnalyzerPlugin()
111
115
  ],
112
116
  optimization: {
113
117
  minimizer: [
@@ -11,6 +11,7 @@ node_modules
11
11
  dist
12
12
  dist-ssr
13
13
  *.local
14
+ stats.html
14
15
 
15
16
  # Editor directories and files
16
17
  .vscode/*
@@ -1,13 +1,13 @@
1
- <!DOCTYPE html>
1
+ <!doctype html>
2
2
  <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>Vite + Vue + TS</title>
8
- </head>
9
- <body>
10
- <div id="app"></div>
11
- <script type="module" src="main.ts"></script>
12
- </body>
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Vite + Vue + TS</title>
8
+ </head>
9
+ <body>
10
+ <div id="app"></div>
11
+ <script type="module" src="/main.ts"></script>
12
+ </body>
13
13
  </html>
@@ -7,6 +7,7 @@
7
7
  "prepare": "husky install",
8
8
  "dev": "vite",
9
9
  "build": "vue-tsc --noEmit && vite build",
10
+ "build:analyse": "tsc --noEmit && vite build --mode analyse",
10
11
  "preview": "vite preview",
11
12
  "format": "prettier --write \"**/*.{ts,js,tsx,jsx,json,vue,css,scss,less}\"",
12
13
  "lint": "eslint **/*.{ts,tsx,js,jsx,vue} && stylelint **/*.{css,scss,less}",
@@ -47,6 +48,7 @@
47
48
  "postcss-import": "15.1.0",
48
49
  "postcss-nesting": "11.2.2",
49
50
  "prettier": "3.0.0",
51
+ "rollup-plugin-visualizer": "5.9.2",
50
52
  "stylelint": "15.7.0",
51
53
  "stylelint-config-standard": "33.0.0",
52
54
  "tailwindcss": "3.3.1",
@@ -4,6 +4,8 @@ import vueJsx from '@vitejs/plugin-vue-jsx'
4
4
  import svgLoader from 'vite-svg-loader'
5
5
  import mockDevServer from 'vite-plugin-mock-dev-server'
6
6
  import checker from 'vite-plugin-checker'
7
+ import { visualizer } from 'rollup-plugin-visualizer'
8
+ import { includes } from 'lodash-es'
7
9
  import { createChunks } from './scripts'
8
10
 
9
11
  // https://vitejs.dev/config/
@@ -40,6 +42,10 @@ export default defineConfig(({ mode }) => {
40
42
  include: ['**/*.mock.{ts,js}']
41
43
  })
42
44
  ]
45
+
46
+ if (mode === 'analyse') {
47
+ plugins.push(visualizer({ open: true, sourcemap: true, brotliSize: true, gzipSize: true }))
48
+ }
43
49
  return {
44
50
  base: env.VITE_BASE_URL,
45
51
  plugins,
@@ -49,9 +55,10 @@ export default defineConfig(({ mode }) => {
49
55
  }
50
56
  },
51
57
  esbuild: {
52
- drop: mode === 'production' ? ['console', 'debugger'] : []
58
+ drop: includes(['production', 'analyse'], mode) ? ['console', 'debugger'] : []
53
59
  },
54
60
  build: {
61
+ sourcemap: mode === 'analyse',
55
62
  rollupOptions: {
56
63
  output: {
57
64
  manualChunks: createChunks({