Fix the weirdness with esbuild definition variables. Apparently it's even worse than enforcing a type, but now it requires a string in the setting in build.js, but turns that into code.

main
Zed A. Shaw 1 year ago
parent a0c342d131
commit ea88de1b81
  1. 2
      admin/App.svelte
  2. 2
      client/App.svelte
  3. 4
      commands/build.js

@ -7,7 +7,7 @@
<Router {routes}/>
{#if process.env.DANGER_ADMIN === "1"}
{#if process.env.DANGER_ADMIN}
<Reloader />
<Bandolier shown={ false }/>
{/if}

@ -7,7 +7,7 @@
<Router {routes}/>
{#if process.env.DANGER_ADMIN === "1"}
{#if process.env.DANGER_ADMIN}
<Reloader />
<Bandolier shown={ false }/>
{/if}

@ -118,8 +118,8 @@ const devMode = () => ({
setup(build) {
const options = build.initialOptions;
options.define = options.define || {};
// esbuild 0.16 went insane and now type checks environment variables. What a bunch of idiots.
options.define['process.env.DANGER_ADMIN'] = options.minify ? "1" : "0";
// esbuild 0.16 requires this to be a string, but changes it to code so this will be an actual boolean type in the code
options.define['process.env.DANGER_ADMIN'] = options.minify ? "false" : "true";
}
})

Loading…
Cancel
Save