Skip to content

Commit d014556

Browse files
committed
fix esm-env warning by adding conditions
1 parent e5b887d commit d014556

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ test:
2323
prod: lint test
2424
rm -rf ./public/build $(ZIP_CHROME_FILE)
2525
NODE_ENV=production \
26-
time deno run --allow-env --allow-read --allow-run deno-bundle.ts --production
26+
time deno run --allow-env --allow-read --allow-run deno-bundle.ts
2727
zip -r $(ZIP_CHROME_FILE) ./public ./manifest.json > /dev/null
2828

2929
.PHONY: clean install dev lint prod test

deno-bundle.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { build, stop, context, type BuildOptions } from 'esbuild';
1+
import { build, context, type BuildOptions } from 'esbuild';
22
import esbuildSvelte from 'esbuild-svelte';
33
import { sveltePreprocess } from 'svelte-preprocess';
44
import manifest from './manifest.json' with { type: 'json' };
55

66
const isProd = process.env.NODE_ENV === 'production';
7-
console.log('🚧', isProd ? 'production' : 'development');
7+
console.log('🚧', process.env.NODE_ENV);
88

99
const buildOptions: BuildOptions = {
1010
plugins: [
@@ -30,6 +30,7 @@ const buildOptions: BuildOptions = {
3030
platform: 'browser',
3131
format: 'iife',
3232
target: 'esnext',
33+
conditions: [`${process.env.NODE_ENV}`],
3334
minify: isProd,
3435
sourcemap: false,
3536
treeShaking: true,

0 commit comments

Comments
 (0)