@skyvexsoftware/stratos-sdk 0.22.0 → 0.22.1
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/vite/plugin-config.js +25 -0
- package/package.json +1 -1
|
@@ -153,6 +153,10 @@ function createUIConfig(pluginDir, entry, extraConfig) {
|
|
|
153
153
|
},
|
|
154
154
|
rollupOptions: {
|
|
155
155
|
external: [...UI_EXTERNALS],
|
|
156
|
+
// One file only. If the direct file:// import fails, or after a hot
|
|
157
|
+
// plugin update, Stratos loads ui/index.js from a blob: URL, where a
|
|
158
|
+
// relative import of another chunk can't resolve.
|
|
159
|
+
output: { inlineDynamicImports: true },
|
|
156
160
|
},
|
|
157
161
|
sourcemap: true,
|
|
158
162
|
minify: isProduction ? "esbuild" : false,
|
|
@@ -170,6 +174,7 @@ function createUIConfig(pluginDir, entry, extraConfig) {
|
|
|
170
174
|
alias: mergedAlias,
|
|
171
175
|
},
|
|
172
176
|
plugins: [
|
|
177
|
+
processEnvDefine(),
|
|
173
178
|
serveExternals(),
|
|
174
179
|
hmrBaseRewrite(),
|
|
175
180
|
stratosDevServer({ pluginDir }),
|
|
@@ -180,6 +185,26 @@ function createUIConfig(pluginDir, entry, extraConfig) {
|
|
|
180
185
|
],
|
|
181
186
|
};
|
|
182
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* The renderer has no Node `process`, and library mode leaves
|
|
190
|
+
* `process.env.NODE_ENV` in the bundle, so libraries that read it (MapLibre,
|
|
191
|
+
* deck.gl, React builds) throw "process is not defined" at load. Replace it
|
|
192
|
+
* with the build's mode, and any other `process.env.X` with undefined.
|
|
193
|
+
*/
|
|
194
|
+
function processEnvDefine() {
|
|
195
|
+
return {
|
|
196
|
+
name: "stratos-process-env-define",
|
|
197
|
+
config(_config, { mode }) {
|
|
198
|
+
const nodeEnv = mode === "production" ? "production" : "development";
|
|
199
|
+
return {
|
|
200
|
+
define: {
|
|
201
|
+
"process.env.NODE_ENV": JSON.stringify(nodeEnv),
|
|
202
|
+
"process.env": JSON.stringify({ NODE_ENV: nodeEnv }),
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
}
|
|
183
208
|
/**
|
|
184
209
|
* Shared background build configuration — used both for the production
|
|
185
210
|
* build (createBackgroundConfig below) and the dev hot-rebuilder in
|