Skip to content

Commit

Permalink
Make $dev$, $prod$ and $debug$ env flags work with bundler
Browse files Browse the repository at this point in the history
  • Loading branch information
somebee committed Jan 25, 2024
1 parent 2ecefa3 commit 0a9e990
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/imba/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class Something

* Make runtime `$someflag$` compile to `globalThis.IMBA_ENV_SOMEFLAG`

* Make `$dev$`, `$prod$` and `$debug$` env flags work with bundler

## 2.0.0-alpha.235

* Call MyMixin.mixes(class) for every class that mixes in MyMixin (if mixes function is defined).
Expand Down
6 changes: 5 additions & 1 deletion packages/imba/src/bundler/bundle.imba
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,10 @@ export default class Bundle < Component
defines["globalThis.IMBA_DEV"] ||= String(hmr?)
defines["globalThis.IMBA_RUN"] ||= String(run?)

defines["globalThis.IMBA_ENV_DEV"] ||= String(!production?)
defines["globalThis.IMBA_ENV_PROD"] ||= String(production?)
defines["globalThis.IMBA_ENV_DEBUG"] ||= String(!production? and run?)

if nodeish? and main? and esm?
# backwards compatibility with other things?
# only if there is no other require already imported this is a bit risky
Expand Down Expand Up @@ -1105,7 +1109,7 @@ export default class Bundle < Component
urls: {}
}

if process.env.DEBUG or false
if process.env.DEBUG

let tmpsrc = np.resolve(fs.cwd,'dist')
meta.entryPoints = esoptions.entryPoints
Expand Down

0 comments on commit 0a9e990

Please sign in to comment.