@promoboxx/react-scripts-vite 0.1.24 → 0.1.25
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/viteConfig.d.ts +1 -0
- package/dist/viteConfig.js +70 -55
- package/package.json +1 -1
package/dist/viteConfig.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ interface ReactScriptsViteOptions {
|
|
|
12
12
|
tsconfigPaths?: false | Parameters<typeof tsconfigPaths>[0];
|
|
13
13
|
pwa?: false | Parameters<typeof VitePWA>[0];
|
|
14
14
|
checker: false | Parameters<typeof pluginChecker>[0];
|
|
15
|
+
envPrefix?: string;
|
|
15
16
|
}
|
|
16
17
|
export declare const pluginOptions: ReactScriptsViteOptions;
|
|
17
18
|
declare const viteConfig: UserConfigFn;
|
package/dist/viteConfig.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
15
|
};
|
|
@@ -11,7 +22,7 @@ var vite_plugin_env_compatible_1 = __importDefault(require("vite-plugin-env-comp
|
|
|
11
22
|
var vite_plugin_pwa_1 = require("vite-plugin-pwa");
|
|
12
23
|
var vite_plugin_svgr_1 = __importDefault(require("vite-plugin-svgr"));
|
|
13
24
|
var vite_tsconfig_paths_1 = __importDefault(require("vite-tsconfig-paths"));
|
|
14
|
-
var
|
|
25
|
+
var replaceEnvInHtml_1 = __importDefault(require("./replaceEnvInHtml"));
|
|
15
26
|
exports.pluginOptions = {
|
|
16
27
|
checker: {
|
|
17
28
|
eslint: process.env.DISABLE_ESLINT_PLUGIN === 'true'
|
|
@@ -22,64 +33,68 @@ exports.pluginOptions = {
|
|
|
22
33
|
typescript: process.env.TSC_COMPILE_ON_ERROR !== 'true',
|
|
23
34
|
enableBuild: true,
|
|
24
35
|
},
|
|
25
|
-
envCompatible: {
|
|
26
|
-
prefix: ENV_PREFIX,
|
|
27
|
-
},
|
|
28
36
|
react: {
|
|
29
37
|
fastRefresh: process.env.FAST_REFRESH !== 'false',
|
|
30
38
|
jsxRuntime: process.env.DISABLE_NEW_JSX_TRANSFORM === 'true' ? 'classic' : undefined,
|
|
31
39
|
},
|
|
32
40
|
};
|
|
33
|
-
var viteConfig = function () {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
41
|
+
var viteConfig = function () {
|
|
42
|
+
var ENV_PREFIX = exports.pluginOptions.envPrefix || 'REACT_APP_';
|
|
43
|
+
if (exports.pluginOptions.envCompatible !== false) {
|
|
44
|
+
exports.pluginOptions.envCompatible = __assign({ prefix: ENV_PREFIX }, exports.pluginOptions.envCompatible);
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
base: process.env.PUBLIC_URL,
|
|
48
|
+
envPrefix: ENV_PREFIX,
|
|
49
|
+
build: {
|
|
50
|
+
outDir: process.env.BUILD_PATH || 'build',
|
|
51
|
+
sourcemap: process.env.GENERATE_SOURCEMAP !== 'false',
|
|
52
|
+
assetsInlineLimit: process.env.IMAGE_INLINE_SIZE_LIMIT
|
|
53
|
+
? Number(process.env.IMAGE_INLINE_SIZE_LIMIT)
|
|
54
|
+
: 10000,
|
|
55
|
+
},
|
|
56
|
+
plugins: [
|
|
57
|
+
// Replace %ENVIRONMENT_VARIABLES% in .html files
|
|
58
|
+
(0, replaceEnvInHtml_1.default)(),
|
|
59
|
+
// React specific.
|
|
60
|
+
exports.pluginOptions.react === false ? null : (0, plugin_react_1.default)(exports.pluginOptions.react),
|
|
61
|
+
exports.pluginOptions.svgr === false ? null : (0, vite_plugin_svgr_1.default)(exports.pluginOptions.svgr),
|
|
62
|
+
// import.meta.env -> process.env
|
|
63
|
+
exports.pluginOptions.envCompatible === false
|
|
64
|
+
? null
|
|
65
|
+
: (0, vite_plugin_env_compatible_1.default)(exports.pluginOptions.envCompatible),
|
|
66
|
+
// Support TypeScript paths.
|
|
67
|
+
exports.pluginOptions.tsconfigPaths === false
|
|
68
|
+
? null
|
|
69
|
+
: (0, vite_tsconfig_paths_1.default)(exports.pluginOptions.tsconfigPaths),
|
|
70
|
+
// PWA.
|
|
71
|
+
exports.pluginOptions.pwa === false ? null : (0, vite_plugin_pwa_1.VitePWA)(exports.pluginOptions.pwa),
|
|
72
|
+
// Check for issues.
|
|
73
|
+
process.env.NODE_ENV === 'test' || exports.pluginOptions.checker === false
|
|
74
|
+
? null
|
|
75
|
+
: (0, vite_plugin_checker_1.default)(exports.pluginOptions.checker),
|
|
76
|
+
],
|
|
77
|
+
server: {
|
|
78
|
+
open: true,
|
|
79
|
+
host: process.env.HOST || '0.0.0.0',
|
|
80
|
+
port: process.env.PORT ? Number(process.env.PORT) : 3000,
|
|
81
|
+
https: process.env.HTTPS === 'true'
|
|
82
|
+
? {
|
|
83
|
+
cert: process.env.SSL_CRT_FILE
|
|
84
|
+
? fs_1.default.readFileSync(process.env.SSL_CRT_FILE)
|
|
85
|
+
: undefined,
|
|
86
|
+
key: process.env.SSL_KEY_FILE
|
|
87
|
+
? fs_1.default.readFileSync(process.env.SSL_KEY_FILE)
|
|
88
|
+
: undefined,
|
|
89
|
+
}
|
|
90
|
+
: undefined,
|
|
91
|
+
},
|
|
92
|
+
test: {
|
|
93
|
+
globals: true,
|
|
94
|
+
environment: 'jsdom',
|
|
95
|
+
setupFiles: './src/test/setup.ts',
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
};
|
|
84
99
|
exports.default = viteConfig;
|
|
85
100
|
//# sourceMappingURL=viteConfig.js.map
|