@rpcbase/vite 0.82.0 → 0.84.0
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/index.js +11 -5
- package/package.json +1 -2
- package/posthogSourcemapsPlugin.js +9 -2
package/index.js
CHANGED
|
@@ -95,8 +95,7 @@ const integratedPackages = [
|
|
|
95
95
|
"posthog-js/react",
|
|
96
96
|
"posthog-node",
|
|
97
97
|
"react-router",
|
|
98
|
-
"react-hook-form"
|
|
99
|
-
"react-use"
|
|
98
|
+
"react-hook-form"
|
|
100
99
|
]
|
|
101
100
|
|
|
102
101
|
// Add each integrated package to resolveAliases
|
|
@@ -105,6 +104,12 @@ integratedPackages.forEach(pkg => {
|
|
|
105
104
|
resolveAliases[pkg] = resolved
|
|
106
105
|
})
|
|
107
106
|
|
|
107
|
+
// Force PostHog React imports to resolve to the ESM bundle to avoid Node ESM
|
|
108
|
+
// directory import errors while keeping SSR compatibility.
|
|
109
|
+
const posthogReactEsm = resolveIntegratedPackagePath("posthog-js/react/dist/esm/index.js")
|
|
110
|
+
resolveAliases["posthog-js/react"] = posthogReactEsm
|
|
111
|
+
resolveAliases["posthog-js/react/dist/esm/index.js"] = posthogReactEsm
|
|
112
|
+
|
|
108
113
|
export {resolveAliases}
|
|
109
114
|
|
|
110
115
|
const rbPackagesNeedingEnvPolyfill = [
|
|
@@ -153,8 +158,8 @@ const getBaseConfig = ({ command, mode, isSsrBuild, isPreview }) => {
|
|
|
153
158
|
inlinePattern: ["**/*.css"],
|
|
154
159
|
removeViteModuleLoader: false
|
|
155
160
|
}),
|
|
156
|
-
|
|
157
|
-
|
|
161
|
+
|
|
162
|
+
isProduction && posthogSourcemapsPlugin({}),
|
|
158
163
|
].filter(Boolean),
|
|
159
164
|
define: {
|
|
160
165
|
__vite_env__: runtimeEnv,
|
|
@@ -200,7 +205,7 @@ const getBaseConfig = ({ command, mode, isSsrBuild, isPreview }) => {
|
|
|
200
205
|
],
|
|
201
206
|
noExternal: [
|
|
202
207
|
...rbPackagesNeedingEnvPolyfill,
|
|
203
|
-
"react-use",
|
|
208
|
+
// "react-use",
|
|
204
209
|
],
|
|
205
210
|
},
|
|
206
211
|
optimizeDeps: {
|
|
@@ -314,6 +319,7 @@ export const createServer = viteCreateServer
|
|
|
314
319
|
// return viteServer
|
|
315
320
|
// }
|
|
316
321
|
|
|
322
|
+
// TODO: I think is is unused, verify and remove if so
|
|
317
323
|
export const disableAppCache = (app) => {
|
|
318
324
|
app.set("etag", false)
|
|
319
325
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpcbase/vite",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.84.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -39,7 +39,6 @@
|
|
|
39
39
|
"react-dom": "19.2.0",
|
|
40
40
|
"react-hook-form": "7.66.0",
|
|
41
41
|
"react-router": "7.9.6",
|
|
42
|
-
"react-use": "17.6.0",
|
|
43
42
|
"tailwindcss": "4.1.17",
|
|
44
43
|
"validator": "13.15.23",
|
|
45
44
|
"vite": "7.2.2",
|
|
@@ -47,15 +47,22 @@ export function posthogSourcemapsPlugin(opts = {}) {
|
|
|
47
47
|
name: "posthog-sourcemaps",
|
|
48
48
|
apply: "build",
|
|
49
49
|
closeBundle: async () => {
|
|
50
|
+
const orange = "\x1b[38;5;208m"
|
|
51
|
+
const reset = "\x1b[0m"
|
|
52
|
+
|
|
50
53
|
const envId = process.env.POSTHOG_CLI_ENV_ID
|
|
51
54
|
const token = process.env.POSTHOG_CLI_TOKEN
|
|
52
55
|
if (!envId || !token) {
|
|
53
|
-
|
|
54
|
-
const reset = "\x1b[0m"
|
|
56
|
+
|
|
55
57
|
console.warn(`${orange}posthog-sourcemaps: plugin is enabled but no env vars for auth configured (POSTHOG_CLI_ENV_ID/POSTHOG_CLI_TOKEN). Skipping without failing.${reset}`)
|
|
56
58
|
return
|
|
57
59
|
}
|
|
58
60
|
|
|
61
|
+
if (!process.env.CI) {
|
|
62
|
+
console.warn(`${orange}posthog-sourcemaps: plugin has correct configuration, but refusing to run when process.env.CI is not set. Skipping without failing.${reset}`)
|
|
63
|
+
return
|
|
64
|
+
}
|
|
65
|
+
|
|
59
66
|
const injectArgs = ["sourcemap", "inject", "--directory", directory]
|
|
60
67
|
if (version) injectArgs.push("--version", version)
|
|
61
68
|
|