@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.
@@ -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;
@@ -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 ENV_PREFIX = 'REACT_APP_';
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 () { return ({
34
- base: process.env.PUBLIC_URL,
35
- // TODO This doesn't really fit in with pluginOptions.
36
- envPrefix: ENV_PREFIX,
37
- build: {
38
- outDir: process.env.BUILD_PATH || 'build',
39
- sourcemap: process.env.GENERATE_SOURCEMAP !== 'false',
40
- assetsInlineLimit: process.env.IMAGE_INLINE_SIZE_LIMIT
41
- ? Number(process.env.IMAGE_INLINE_SIZE_LIMIT)
42
- : 10000,
43
- },
44
- plugins: [
45
- // React specific.
46
- exports.pluginOptions.react === false ? null : (0, plugin_react_1.default)(exports.pluginOptions.react),
47
- exports.pluginOptions.svgr === false ? null : (0, vite_plugin_svgr_1.default)(exports.pluginOptions.svgr),
48
- // import.meta.env -> process.env
49
- exports.pluginOptions.envCompatible === false
50
- ? null
51
- : (0, vite_plugin_env_compatible_1.default)(exports.pluginOptions.envCompatible),
52
- // Support TypeScript paths.
53
- exports.pluginOptions.tsconfigPaths === false
54
- ? null
55
- : (0, vite_tsconfig_paths_1.default)(exports.pluginOptions.tsconfigPaths),
56
- // PWA.
57
- exports.pluginOptions.pwa === false ? null : (0, vite_plugin_pwa_1.VitePWA)(exports.pluginOptions.pwa),
58
- // Check for issues.
59
- process.env.NODE_ENV === 'test' || exports.pluginOptions.checker === false
60
- ? null
61
- : (0, vite_plugin_checker_1.default)(exports.pluginOptions.checker),
62
- ],
63
- server: {
64
- open: true,
65
- host: process.env.HOST || '0.0.0.0',
66
- port: process.env.PORT ? Number(process.env.PORT) : 3000,
67
- https: process.env.HTTPS === 'true'
68
- ? {
69
- cert: process.env.SSL_CRT_FILE
70
- ? fs_1.default.readFileSync(process.env.SSL_CRT_FILE)
71
- : undefined,
72
- key: process.env.SSL_KEY_FILE
73
- ? fs_1.default.readFileSync(process.env.SSL_KEY_FILE)
74
- : undefined,
75
- }
76
- : undefined,
77
- },
78
- test: {
79
- globals: true,
80
- environment: 'jsdom',
81
- setupFiles: './src/test/setup.ts',
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promoboxx/react-scripts-vite",
3
- "version": "0.1.24",
3
+ "version": "0.1.25",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "keywords": [],