@rpcbase/vite 0.66.0 → 0.68.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/dotEnvExpand.js +14 -0
- package/index.js +3 -1
- package/package.json +1 -1
- package/posthogSourcemapsPlugin.js +0 -3
package/dotEnvExpand.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import fs from "fs"
|
|
2
|
+
import path from "path"
|
|
3
|
+
|
|
4
|
+
import dotenv from "dotenv"
|
|
5
|
+
import {expand} from "dotenv-expand"
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const envFilePath = path.resolve(process.cwd(), ".env")
|
|
9
|
+
|
|
10
|
+
if (fs.existsSync(envFilePath)) {
|
|
11
|
+
const parsedFile = dotenv.parse(fs.readFileSync(envFilePath))
|
|
12
|
+
const expanded = expand({ parsed: parsedFile }).parsed || {}
|
|
13
|
+
Object.assign(process.env, expanded)
|
|
14
|
+
}
|
package/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import "./dotEnvExpand.js"
|
|
2
|
+
|
|
1
3
|
import path from "path"
|
|
2
4
|
|
|
3
5
|
import nocache from "nocache"
|
|
@@ -87,7 +89,7 @@ const getBaseConfig = ({ command, mode, isSsrBuild, isPreview }) => {
|
|
|
87
89
|
inlinePattern: ["**/*.css"],
|
|
88
90
|
removeViteModuleLoader: false
|
|
89
91
|
}),
|
|
90
|
-
isProduction && posthogSourcemapsPlugin({
|
|
92
|
+
isProduction && posthogSourcemapsPlugin({}),
|
|
91
93
|
].filter(Boolean),
|
|
92
94
|
define: {
|
|
93
95
|
__vite_env__: {
|
package/package.json
CHANGED
|
@@ -35,7 +35,6 @@ function resolvePosthogCliBin() {
|
|
|
35
35
|
export function posthogSourcemapsPlugin(opts = {}) {
|
|
36
36
|
const {
|
|
37
37
|
directory = "build/dist",
|
|
38
|
-
project,
|
|
39
38
|
version,
|
|
40
39
|
host = process.env.RB_PUBLIC_POSTHOG_HOST || "https://eu.posthog.com",
|
|
41
40
|
deleteAfterUpload = true
|
|
@@ -48,7 +47,6 @@ export function posthogSourcemapsPlugin(opts = {}) {
|
|
|
48
47
|
name: "posthog-sourcemaps",
|
|
49
48
|
apply: "build",
|
|
50
49
|
closeBundle: async () => {
|
|
51
|
-
console.log("ENVV", process.env)
|
|
52
50
|
const envId = process.env.POSTHOG_CLI_ENV_ID
|
|
53
51
|
const token = process.env.POSTHOG_CLI_TOKEN
|
|
54
52
|
if (!envId || !token) {
|
|
@@ -59,7 +57,6 @@ export function posthogSourcemapsPlugin(opts = {}) {
|
|
|
59
57
|
}
|
|
60
58
|
|
|
61
59
|
const injectArgs = ["sourcemap", "inject", "--directory", directory]
|
|
62
|
-
if (project) injectArgs.push("--project", project)
|
|
63
60
|
if (version) injectArgs.push("--version", version)
|
|
64
61
|
|
|
65
62
|
const uploadArgs = ["sourcemap", "upload", "--directory", directory]
|