sliftutils 1.7.36 → 1.7.37

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.d.ts CHANGED
@@ -3353,6 +3353,10 @@ declare module "sliftutils/storage/remoteStorage/intermediateSources" {
3353
3353
 
3354
3354
  }
3355
3355
 
3356
+ declare module "sliftutils/storage/remoteStorage/productionEnv" {
3357
+
3358
+ }
3359
+
3356
3360
  declare module "sliftutils/storage/remoteStorage/remoteConfig" {
3357
3361
  /// <reference types="node" />
3358
3362
  /// <reference types="node" />
@@ -3553,6 +3557,7 @@ declare module "sliftutils/storage/remoteStorage/storageController" {
3553
3557
  }
3554
3558
 
3555
3559
  declare module "sliftutils/storage/remoteStorage/storageServer" {
3560
+ import "./productionEnv";
3556
3561
  import "./accessPage";
3557
3562
  export type HostStorageServerConfig = {
3558
3563
  url: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sliftutils",
3
- "version": "1.7.36",
3
+ "version": "1.7.37",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "files": [
File without changes
@@ -0,0 +1,2 @@
1
+ // Packages like mobx pick which build to require at runtime, from process.env.NODE_ENV. The browser require shim runs as production, so a server that loads the development build ships a module graph the client cannot satisfy ("Accessed unexpected module ./mobx.cjs.production.min.js ... Expected imports: ./mobx.cjs.development.js"). Setting this is the only way to make both sides agree, and it MUST happen before anything imports such a package - which is why it lives in its own module, imported first (import statements run in source order, so a plain statement at the top of storageServer.ts would run too late).
2
+ process.env.NODE_ENV = "production";
@@ -1,3 +1,4 @@
1
+ import "./productionEnv";
1
2
  import "./accessPage";
2
3
  export type HostStorageServerConfig = {
3
4
  url: string;
@@ -1,3 +1,5 @@
1
+ // Must stay the FIRST import: it sets NODE_ENV, which decides which build of mobx (and anything else that switches on it) the imports below load
2
+ import "./productionEnv";
1
3
  import os from "os";
2
4
  import path from "path";
3
5
  import fsp from "fs/promises";
@@ -1,4 +1,3 @@
1
- process.env.NODE_ENV = "production";
2
1
  import { hostStorageServer } from "./storageServer";
3
2
  import { getArg } from "./cliArgs";
4
3