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 2 years 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}/> <Router {routes}/>
{#if process.env.DANGER_ADMIN === "1"} {#if process.env.DANGER_ADMIN}
<Reloader /> <Reloader />
<Bandolier shown={ false }/> <Bandolier shown={ false }/>
{/if} {/if}

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

@ -118,8 +118,8 @@ const devMode = () => ({
setup(build) { setup(build) {
const options = build.initialOptions; const options = build.initialOptions;
options.define = options.define || {}; options.define = options.define || {};
// esbuild 0.16 went insane and now type checks environment variables. What a bunch of idiots. // 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 ? "1" : "0"; options.define['process.env.DANGER_ADMIN'] = options.minify ? "false" : "true";
} }
}) })

Loading…
Cancel
Save