create-packer 1.35.6 → 1.35.7
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
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
import 'styled-components'
|
|
3
3
|
import { themeType } from './shared/theme'
|
|
4
4
|
|
|
5
|
+
declare module '*.svg' {
|
|
6
|
+
const content: string
|
|
7
|
+
export default content
|
|
8
|
+
}
|
|
9
|
+
declare module '*.svg?react' {
|
|
10
|
+
const ReactComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement>>
|
|
11
|
+
export default ReactComponent
|
|
12
|
+
}
|
|
13
|
+
|
|
5
14
|
declare module 'styled-components' {
|
|
6
15
|
export interface DefaultTheme extends themeType {}
|
|
7
16
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineConfig, loadEnv
|
|
1
|
+
import { defineConfig, loadEnv } from '@rsbuild/core'
|
|
2
2
|
import { pluginReact } from '@rsbuild/plugin-react'
|
|
3
3
|
import { pluginStyledComponents } from '@rsbuild/plugin-styled-components'
|
|
4
4
|
import { pluginEslint } from '@rsbuild/plugin-eslint'
|
|
@@ -7,29 +7,7 @@ import { pluginTypeCheck } from '@rsbuild/plugin-type-check'
|
|
|
7
7
|
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
|
|
8
8
|
import { RsdoctorRspackPlugin } from '@rsdoctor/rspack-plugin'
|
|
9
9
|
import { pluginSvgr } from '@rsbuild/plugin-svgr'
|
|
10
|
-
|
|
11
|
-
function createChunks(chunks: Array<{ name: string; libs: string[] | RegExp; priority?: number }>) {
|
|
12
|
-
const result: CacheGroups = {
|
|
13
|
-
vendors: {
|
|
14
|
-
test: /[\\/]node_modules[\\/]/,
|
|
15
|
-
chunks: 'all',
|
|
16
|
-
name: 'vendors',
|
|
17
|
-
priority: -1
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
chunks.forEach(({ name, libs, priority }) => {
|
|
21
|
-
result[name] = {
|
|
22
|
-
test: Array.isArray(libs)
|
|
23
|
-
? new RegExp(`[\\\\/]node_modules[\\\\/](${libs.join('|')})[\\\\/]`)
|
|
24
|
-
: libs,
|
|
25
|
-
chunks: 'all',
|
|
26
|
-
name,
|
|
27
|
-
priority
|
|
28
|
-
}
|
|
29
|
-
return result
|
|
30
|
-
})
|
|
31
|
-
return result
|
|
32
|
-
}
|
|
10
|
+
import { createChunks } from './scripts/createChunks'
|
|
33
11
|
|
|
34
12
|
export default defineConfig(({ envMode, command }) => {
|
|
35
13
|
const { parsed: env } = loadEnv()
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CacheGroups } from '@rsbuild/core'
|
|
2
|
+
|
|
3
|
+
export function createChunks(
|
|
4
|
+
chunks: Array<{ name: string; libs: string[] | RegExp; priority?: number }>
|
|
5
|
+
) {
|
|
6
|
+
const result: CacheGroups = {
|
|
7
|
+
vendors: {
|
|
8
|
+
test: /[\\/]node_modules[\\/]/,
|
|
9
|
+
chunks: 'all',
|
|
10
|
+
name: 'vendors',
|
|
11
|
+
priority: -1
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
chunks.forEach(({ name, libs, priority }) => {
|
|
15
|
+
result[name] = {
|
|
16
|
+
test: Array.isArray(libs)
|
|
17
|
+
? new RegExp(`[\\\\/]node_modules[\\\\/](${libs.join('|')})[\\\\/]`)
|
|
18
|
+
: libs,
|
|
19
|
+
chunks: 'all',
|
|
20
|
+
name,
|
|
21
|
+
priority
|
|
22
|
+
}
|
|
23
|
+
return result
|
|
24
|
+
})
|
|
25
|
+
return result
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './createChunks'
|