create-packer 1.25.6 → 1.25.8

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.25.6",
3
+ "version": "1.25.8",
4
4
  "main": "index.js",
5
5
  "repository": "https://github.com/kevily/create-packer",
6
6
  "author": "1k <bug_zero@163.com>",
@@ -1,4 +1,14 @@
1
- # webpack-cli
2
- - dev: npm run dev
3
- - build: npm run build
1
+ # react-app-webpack
4
2
 
3
+ - dev: pnpm run dev
4
+ - build: pnpm run build
5
+ - build:dev: pnpm run build:dev -> use ".env.dev"
6
+
7
+ # svg
8
+
9
+ - import IconReact from '@/assets/react.svg' -> ReactComponent
10
+ - import iconReact from '@/assets/react.svg?url' -> svg url
11
+
12
+ # style
13
+
14
+ - index.module.css -> css module
@@ -6,13 +6,12 @@ declare module '*.less'
6
6
  declare module '*.scss'
7
7
  declare module '*.png'
8
8
  declare module '*.webp'
9
- declare module '*.svg' {
10
- import * as React from 'react'
11
-
12
- export const ReactComponent: React.FunctionComponent<
13
- React.ComponentProps<'svg'> & { title?: string }
14
- >
15
- export function ReactComponent(props: React.SVGProps<SVGSVGElement>): React.ReactElement
9
+ declare module '*.svg?url' {
16
10
  const url: string
17
11
  export default url
18
12
  }
13
+ declare module '*.svg' {
14
+ import * as React from 'react'
15
+ function ReactComponent(props: React.SVGProps<SVGSVGElement>): React.ReactElement
16
+ export default ReactComponent
17
+ }
@@ -34,6 +34,7 @@
34
34
  "@commitlint/cli": "17.7.1",
35
35
  "@commitlint/config-conventional": "17.7.0",
36
36
  "@commitlint/cz-commitlint": "17.7.1",
37
+ "@svgr/webpack": "^8.1.0",
37
38
  "@types/lodash-es": "4.17.8",
38
39
  "@types/qs": "6.9.7",
39
40
  "@types/react": "18.2.21",
@@ -22,5 +22,5 @@
22
22
  }
23
23
  },
24
24
  "include": ["**/*.tsx", "**/*.ts"],
25
- "exclude": ["scripts", "vite.config.ts"]
25
+ "exclude": ["scripts"]
26
26
  }
@@ -84,9 +84,20 @@ export default function (env) {
84
84
  }
85
85
  },
86
86
  {
87
- test: /\.(png|svg|jpg|jpeg|gif)$/i,
87
+ test: /\.(png|jpg|jpeg|gif)$/i,
88
88
  type: 'asset/resource'
89
89
  },
90
+ {
91
+ test: /\.svg$/i,
92
+ type: 'asset/resource',
93
+ resourceQuery: /url/ // *.svg?url
94
+ },
95
+ {
96
+ test: /\.svg$/i,
97
+ issuer: /\.[jt]sx?$/,
98
+ resourceQuery: { not: [/url/] }, // exclude react component if *.svg?url
99
+ use: ['@svgr/webpack']
100
+ },
90
101
  {
91
102
  test: /\.(woff|woff2|eot|ttf|otf)$/i,
92
103
  type: 'asset/resource'