create-packer 1.35.8 → 1.35.10

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.35.8",
3
+ "version": "1.35.10",
4
4
  "main": "index.js",
5
5
  "repository": "https://github.com/kevily/create-packer",
6
6
  "author": "1k <bug_zero@163.com>",
@@ -1,2 +1,2 @@
1
1
  PUBLIC_BASE_URL=/
2
- PUBLIC_API_HOST=
2
+ PUBLIC_API_HOST=/
@@ -2,11 +2,10 @@
2
2
  import 'styled-components'
3
3
  import { themeType } from './shared/theme'
4
4
 
5
+ declare module 'styled-components' {
6
+ export interface DefaultTheme extends themeType {}
7
+ }
5
8
  declare global {
6
- declare module 'styled-components' {
7
- export interface DefaultTheme extends themeType {}
8
- }
9
-
10
9
  interface ImportMetaEnv {
11
10
  // import.meta.env.PUBLIC_FOO
12
11
  readonly PUBLIC_BASE_URL: string
@@ -11,7 +11,8 @@ import { createChunks } from './scripts/createChunks'
11
11
 
12
12
  export default defineConfig(({ envMode, command }) => {
13
13
  const { parsed: env } = loadEnv()
14
- const proxyBaseUrl = env.PUBLIC_BASE_URL + env.PUBLIC_API_HOST
14
+ const proxyBaseUrl = env.PUBLIC_API_HOST
15
+ const publicPath = env.PUBLIC_BASE_URL
15
16
  return {
16
17
  html: {
17
18
  template: './index.html'
@@ -24,6 +25,16 @@ export default defineConfig(({ envMode, command }) => {
24
25
  '@': __dirname
25
26
  }
26
27
  },
28
+ dev: {
29
+ distPath: {
30
+ root: 'dist'
31
+ },
32
+ assetPrefix: publicPath,
33
+ minify: envMode !== 'dev'
34
+ },
35
+ output: {
36
+ assetPrefix: publicPath
37
+ },
27
38
  tools: {
28
39
  rspack: {
29
40
  plugins: [
@@ -57,8 +68,20 @@ export default defineConfig(({ envMode, command }) => {
57
68
  },
58
69
  server: {
59
70
  host: '0.0.0.0',
60
- proxy: {
61
- [proxyBaseUrl]: {
71
+ compress: false,
72
+ publicDir: {
73
+ name: publicPath
74
+ },
75
+ historyApiFallback: {
76
+ disableDotRule: true,
77
+ index: publicPath
78
+ },
79
+ printUrls({ urls }) {
80
+ return urls.map(url => url + publicPath)
81
+ },
82
+ proxy: [
83
+ {
84
+ context: [proxyBaseUrl],
62
85
  target: 'http://127.0.0.1:3000',
63
86
  changeOrigin: true,
64
87
  secure: false,
@@ -66,7 +89,7 @@ export default defineConfig(({ envMode, command }) => {
66
89
  [proxyBaseUrl]: ''
67
90
  }
68
91
  }
69
- }
92
+ ]
70
93
  }
71
94
  }
72
95
  })