@promoboxx/react-scripts-vite 0.2.4 → 0.2.6
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/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +3 -3
- package/dist/cjs/splitVendorManualChunks.d.ts +5 -0
- package/dist/cjs/splitVendorManualChunks.js +31 -0
- package/dist/cjs/viteConfig.d.ts +5 -2
- package/dist/cjs/viteConfig.js +17 -7
- package/dist/esm/index.d.mts +1 -0
- package/dist/esm/splitVendorManualChunks.d.mts +5 -0
- package/dist/esm/splitVendorManualChunks.mjs +10 -0
- package/dist/esm/viteConfig.d.mts +2 -1
- package/dist/esm/viteConfig.mjs +17 -7
- package/package.json +16 -16
package/dist/cjs/index.d.ts
CHANGED
package/dist/cjs/index.js
CHANGED
|
@@ -28,12 +28,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
|
|
30
30
|
// src/index.ts
|
|
31
|
-
var
|
|
32
|
-
__export(
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
33
|
pluginOptions: () => import_viteConfig.pluginOptions,
|
|
34
34
|
viteConfig: () => import_viteConfig.default
|
|
35
35
|
});
|
|
36
|
-
module.exports = __toCommonJS(
|
|
36
|
+
module.exports = __toCommonJS(index_exports);
|
|
37
37
|
var import_viteConfig = __toESM(require("./viteConfig"));
|
|
38
38
|
// Annotate the CommonJS export names for ESM import in node:
|
|
39
39
|
0 && (module.exports = {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/splitVendorManualChunks.ts
|
|
21
|
+
var splitVendorManualChunks_exports = {};
|
|
22
|
+
__export(splitVendorManualChunks_exports, {
|
|
23
|
+
default: () => splitVendorManualChunks_default
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(splitVendorManualChunks_exports);
|
|
26
|
+
var splitVendorManualChunks = (id) => {
|
|
27
|
+
if (id.includes("node_modules")) {
|
|
28
|
+
return "vendor";
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
var splitVendorManualChunks_default = splitVendorManualChunks;
|
package/dist/cjs/viteConfig.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import react from '@vitejs/plugin-react';
|
|
2
|
+
import { ManualChunksOption } from 'rollup';
|
|
2
3
|
import { UserConfigFn } from 'vite';
|
|
3
4
|
import pluginChecker from 'vite-plugin-checker';
|
|
4
5
|
import envCompatible from 'vite-plugin-environment';
|
|
@@ -13,9 +14,11 @@ interface ReactScriptsViteOptions {
|
|
|
13
14
|
pwa?: false | Parameters<typeof VitePWA>[0];
|
|
14
15
|
checker?: false | Parameters<typeof pluginChecker>[0];
|
|
15
16
|
envPrefix?: string;
|
|
16
|
-
splitVendorChunkPlugin?:
|
|
17
|
+
splitVendorChunkPlugin?: boolean | ManualChunksOption;
|
|
17
18
|
}
|
|
18
19
|
declare const pluginOptions: ReactScriptsViteOptions;
|
|
19
20
|
declare const viteConfig: UserConfigFn;
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
export = viteConfig;
|
|
24
|
+
export { pluginOptions };
|
package/dist/cjs/viteConfig.js
CHANGED
|
@@ -37,16 +37,17 @@ module.exports = __toCommonJS(viteConfig_exports);
|
|
|
37
37
|
var import_fs = __toESM(require("fs"));
|
|
38
38
|
var import_plugin_react = __toESM(require("@vitejs/plugin-react"));
|
|
39
39
|
var import_alias_hq = __toESM(require("alias-hq"));
|
|
40
|
-
var import_vite = require("vite");
|
|
41
40
|
var import_vite_plugin_checker = __toESM(require("vite-plugin-checker"));
|
|
42
41
|
var import_vite_plugin_environment = __toESM(require("vite-plugin-environment"));
|
|
43
42
|
var import_vite_plugin_pwa = require("vite-plugin-pwa");
|
|
44
43
|
var import_vite_plugin_svgr = __toESM(require("vite-plugin-svgr"));
|
|
45
44
|
var import_replaceEnvInHtml = __toESM(require("./replaceEnvInHtml"));
|
|
45
|
+
var import_splitVendorManualChunks = __toESM(require("./splitVendorManualChunks"));
|
|
46
46
|
var pluginOptions = {
|
|
47
47
|
checker: {
|
|
48
48
|
eslint: process.env.DISABLE_ESLINT_PLUGIN === "true" ? void 0 : {
|
|
49
|
-
lintCommand: `eslint --cache --max-warnings=${process.env.CI === "true" ? 0 : -1} "./src/**/*.{ts,tsx,js,jsx,mjs,cjs}"
|
|
49
|
+
lintCommand: `eslint --cache --max-warnings=${process.env.CI === "true" ? 0 : -1} "./src/**/*.{graphql,ts,tsx,js,jsx,mjs,cjs}"`,
|
|
50
|
+
useFlatConfig: import_fs.default.existsSync("eslint.config.js")
|
|
50
51
|
},
|
|
51
52
|
typescript: process.env.TSC_COMPILE_ON_ERROR !== "true",
|
|
52
53
|
enableBuild: true,
|
|
@@ -83,11 +84,16 @@ var pluginOptions = {
|
|
|
83
84
|
},
|
|
84
85
|
// Finally, remove dimensions, and more importantly, set a viewBox if
|
|
85
86
|
// it doesn't exist.
|
|
86
|
-
"removeDimensions"
|
|
87
|
+
"removeDimensions",
|
|
88
|
+
// Since we're setting custom SVGR/SVGO options, we miss out on any
|
|
89
|
+
// defaults specified there.
|
|
90
|
+
// https://github.com/gregberge/svgr/blob/6b329ac8b9f045ef56ba0020ef4d90c2f3080287/packages/plugin-svgo/src/config.ts#L32-L38
|
|
91
|
+
"prefixIds"
|
|
87
92
|
]
|
|
88
93
|
}
|
|
89
94
|
}
|
|
90
|
-
}
|
|
95
|
+
},
|
|
96
|
+
splitVendorChunkPlugin: true
|
|
91
97
|
};
|
|
92
98
|
var viteConfig = () => {
|
|
93
99
|
const ENV_PREFIX = pluginOptions.envPrefix || "REACT_APP_";
|
|
@@ -103,7 +109,12 @@ var viteConfig = () => {
|
|
|
103
109
|
build: {
|
|
104
110
|
outDir: process.env.BUILD_PATH || "build",
|
|
105
111
|
sourcemap: process.env.GENERATE_SOURCEMAP !== "false",
|
|
106
|
-
assetsInlineLimit: process.env.IMAGE_INLINE_SIZE_LIMIT ? Number(process.env.IMAGE_INLINE_SIZE_LIMIT) : 1e4
|
|
112
|
+
assetsInlineLimit: process.env.IMAGE_INLINE_SIZE_LIMIT ? Number(process.env.IMAGE_INLINE_SIZE_LIMIT) : 1e4,
|
|
113
|
+
rollupOptions: {
|
|
114
|
+
output: {
|
|
115
|
+
manualChunks: pluginOptions.splitVendorChunkPlugin === false ? void 0 : pluginOptions.splitVendorChunkPlugin === true ? import_splitVendorManualChunks.default : pluginOptions.splitVendorChunkPlugin
|
|
116
|
+
}
|
|
117
|
+
}
|
|
107
118
|
},
|
|
108
119
|
plugins: [
|
|
109
120
|
// Replace %ENVIRONMENT_VARIABLES% in .html files
|
|
@@ -116,8 +127,7 @@ var viteConfig = () => {
|
|
|
116
127
|
// PWA.
|
|
117
128
|
pluginOptions.pwa === false ? null : (0, import_vite_plugin_pwa.VitePWA)(pluginOptions.pwa),
|
|
118
129
|
// Check for issues.
|
|
119
|
-
process.env.NODE_ENV === "test" || pluginOptions.checker === false ? null : (0, import_vite_plugin_checker.default)(pluginOptions.checker || {})
|
|
120
|
-
pluginOptions.splitVendorChunkPlugin === false ? null : (0, import_vite.splitVendorChunkPlugin)()
|
|
130
|
+
process.env.NODE_ENV === "test" || pluginOptions.checker === false ? null : (0, import_vite_plugin_checker.default)(pluginOptions.checker || {})
|
|
121
131
|
],
|
|
122
132
|
server: {
|
|
123
133
|
open: true,
|
package/dist/esm/index.d.mts
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// src/splitVendorManualChunks.ts
|
|
2
|
+
var splitVendorManualChunks = (id) => {
|
|
3
|
+
if (id.includes("node_modules")) {
|
|
4
|
+
return "vendor";
|
|
5
|
+
}
|
|
6
|
+
};
|
|
7
|
+
var splitVendorManualChunks_default = splitVendorManualChunks;
|
|
8
|
+
export {
|
|
9
|
+
splitVendorManualChunks_default as default
|
|
10
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import react from '@vitejs/plugin-react';
|
|
2
|
+
import { ManualChunksOption } from 'rollup';
|
|
2
3
|
import { UserConfigFn } from 'vite';
|
|
3
4
|
import pluginChecker from 'vite-plugin-checker';
|
|
4
5
|
import envCompatible from 'vite-plugin-environment';
|
|
@@ -13,7 +14,7 @@ interface ReactScriptsViteOptions {
|
|
|
13
14
|
pwa?: false | Parameters<typeof VitePWA>[0];
|
|
14
15
|
checker?: false | Parameters<typeof pluginChecker>[0];
|
|
15
16
|
envPrefix?: string;
|
|
16
|
-
splitVendorChunkPlugin?:
|
|
17
|
+
splitVendorChunkPlugin?: boolean | ManualChunksOption;
|
|
17
18
|
}
|
|
18
19
|
declare const pluginOptions: ReactScriptsViteOptions;
|
|
19
20
|
declare const viteConfig: UserConfigFn;
|
package/dist/esm/viteConfig.mjs
CHANGED
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
import fs from "fs";
|
|
3
3
|
import react from "@vitejs/plugin-react";
|
|
4
4
|
import aliasHq from "alias-hq";
|
|
5
|
-
import { splitVendorChunkPlugin } from "vite";
|
|
6
5
|
import pluginChecker from "vite-plugin-checker";
|
|
7
6
|
import envCompatible from "vite-plugin-environment";
|
|
8
7
|
import { VitePWA } from "vite-plugin-pwa";
|
|
9
8
|
import svgr from "vite-plugin-svgr";
|
|
10
9
|
import replaceEnvInHtml from "./replaceEnvInHtml.mjs";
|
|
10
|
+
import splitVendorManualChunks from "./splitVendorManualChunks.mjs";
|
|
11
11
|
var pluginOptions = {
|
|
12
12
|
checker: {
|
|
13
13
|
eslint: process.env.DISABLE_ESLINT_PLUGIN === "true" ? void 0 : {
|
|
14
|
-
lintCommand: `eslint --cache --max-warnings=${process.env.CI === "true" ? 0 : -1} "./src/**/*.{ts,tsx,js,jsx,mjs,cjs}"
|
|
14
|
+
lintCommand: `eslint --cache --max-warnings=${process.env.CI === "true" ? 0 : -1} "./src/**/*.{graphql,ts,tsx,js,jsx,mjs,cjs}"`,
|
|
15
|
+
useFlatConfig: fs.existsSync("eslint.config.js")
|
|
15
16
|
},
|
|
16
17
|
typescript: process.env.TSC_COMPILE_ON_ERROR !== "true",
|
|
17
18
|
enableBuild: true,
|
|
@@ -48,11 +49,16 @@ var pluginOptions = {
|
|
|
48
49
|
},
|
|
49
50
|
// Finally, remove dimensions, and more importantly, set a viewBox if
|
|
50
51
|
// it doesn't exist.
|
|
51
|
-
"removeDimensions"
|
|
52
|
+
"removeDimensions",
|
|
53
|
+
// Since we're setting custom SVGR/SVGO options, we miss out on any
|
|
54
|
+
// defaults specified there.
|
|
55
|
+
// https://github.com/gregberge/svgr/blob/6b329ac8b9f045ef56ba0020ef4d90c2f3080287/packages/plugin-svgo/src/config.ts#L32-L38
|
|
56
|
+
"prefixIds"
|
|
52
57
|
]
|
|
53
58
|
}
|
|
54
59
|
}
|
|
55
|
-
}
|
|
60
|
+
},
|
|
61
|
+
splitVendorChunkPlugin: true
|
|
56
62
|
};
|
|
57
63
|
var viteConfig = () => {
|
|
58
64
|
const ENV_PREFIX = pluginOptions.envPrefix || "REACT_APP_";
|
|
@@ -68,7 +74,12 @@ var viteConfig = () => {
|
|
|
68
74
|
build: {
|
|
69
75
|
outDir: process.env.BUILD_PATH || "build",
|
|
70
76
|
sourcemap: process.env.GENERATE_SOURCEMAP !== "false",
|
|
71
|
-
assetsInlineLimit: process.env.IMAGE_INLINE_SIZE_LIMIT ? Number(process.env.IMAGE_INLINE_SIZE_LIMIT) : 1e4
|
|
77
|
+
assetsInlineLimit: process.env.IMAGE_INLINE_SIZE_LIMIT ? Number(process.env.IMAGE_INLINE_SIZE_LIMIT) : 1e4,
|
|
78
|
+
rollupOptions: {
|
|
79
|
+
output: {
|
|
80
|
+
manualChunks: pluginOptions.splitVendorChunkPlugin === false ? void 0 : pluginOptions.splitVendorChunkPlugin === true ? splitVendorManualChunks : pluginOptions.splitVendorChunkPlugin
|
|
81
|
+
}
|
|
82
|
+
}
|
|
72
83
|
},
|
|
73
84
|
plugins: [
|
|
74
85
|
// Replace %ENVIRONMENT_VARIABLES% in .html files
|
|
@@ -81,8 +92,7 @@ var viteConfig = () => {
|
|
|
81
92
|
// PWA.
|
|
82
93
|
pluginOptions.pwa === false ? null : VitePWA(pluginOptions.pwa),
|
|
83
94
|
// Check for issues.
|
|
84
|
-
process.env.NODE_ENV === "test" || pluginOptions.checker === false ? null : pluginChecker(pluginOptions.checker || {})
|
|
85
|
-
pluginOptions.splitVendorChunkPlugin === false ? null : splitVendorChunkPlugin()
|
|
95
|
+
process.env.NODE_ENV === "test" || pluginOptions.checker === false ? null : pluginChecker(pluginOptions.checker || {})
|
|
86
96
|
],
|
|
87
97
|
server: {
|
|
88
98
|
open: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promoboxx/react-scripts-vite",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.mjs",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"author": "",
|
|
18
18
|
"license": "ISC",
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@promoboxx/eslint-config": "^
|
|
21
|
-
"@types/node": "^
|
|
22
|
-
"concurrently": "^
|
|
23
|
-
"prettier": "^3.
|
|
24
|
-
"tsup": "^8.0.
|
|
25
|
-
"typescript": "^5.
|
|
20
|
+
"@promoboxx/eslint-config": "^4.0.2",
|
|
21
|
+
"@types/node": "^22.15.32",
|
|
22
|
+
"concurrently": "^9.2.0",
|
|
23
|
+
"prettier": "^3.6.2",
|
|
24
|
+
"tsup": "^8.0.2",
|
|
25
|
+
"typescript": "^5.9.2"
|
|
26
26
|
},
|
|
27
27
|
"exports": {
|
|
28
28
|
".": {
|
|
@@ -37,16 +37,16 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@svgr/plugin-jsx": "^8.1.0",
|
|
39
39
|
"@svgr/plugin-svgo": "^8.1.0",
|
|
40
|
-
"@vitejs/plugin-react": "^
|
|
41
|
-
"alias-hq": "^6.2.
|
|
42
|
-
"eslint": "^
|
|
43
|
-
"jsdom": "^
|
|
44
|
-
"vite": "^
|
|
45
|
-
"vite-plugin-checker": "^0.
|
|
40
|
+
"@vitejs/plugin-react": "^5.0.4",
|
|
41
|
+
"alias-hq": "^6.2.4",
|
|
42
|
+
"eslint": "^9.38.0",
|
|
43
|
+
"jsdom": "^27.0.1",
|
|
44
|
+
"vite": "^7.1.12",
|
|
45
|
+
"vite-plugin-checker": "^0.11.0",
|
|
46
46
|
"vite-plugin-environment": "^1.1.3",
|
|
47
|
-
"vite-plugin-pwa": "^
|
|
48
|
-
"vite-plugin-svgr": "^4.
|
|
49
|
-
"vitest": "^
|
|
47
|
+
"vite-plugin-pwa": "^1.1.0",
|
|
48
|
+
"vite-plugin-svgr": "^4.5.0",
|
|
49
|
+
"vitest": "^4.0.2"
|
|
50
50
|
},
|
|
51
51
|
"files": [
|
|
52
52
|
"dist"
|