Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the build. Split dev from prod. In dev, convert import.meta.env.DEV to DEBUG from @glimmer/env #1472

Merged
merged 12 commits into from
Oct 30, 2023

Conversation

NullVoxPopuli
Copy link
Contributor

@NullVoxPopuli NullVoxPopuli commented Oct 27, 2023

previously, were kind of compiling away our helpful-information-to-dev-mode users.
but we can't give them import.meta.env either, as our consumers don't have that available.
But they do have DEBUG from @glimmer/env via babel-plugin-debug-macros, so we'll use that.

I also added conditional exports, because:

  • in prod mode (aka, someone using from CDN, or other NODE_ENV=production), we want all debug flags removed for performance
  • in dev mode, we want to swap our import.meta.env for DEBUG from @glimmer/env so that our current main consumer (ember.js) can still to build-time swapping of values for their dev vs prod environment.

After this PR, I'll do a patch release, and test setting up @glimmer/vm (and friends) in a jsbin, which should hopefully verify that all the prod stuff is configured correctly (this may also be an opportunity to update the js-framework-benchmark to see if anything's different over there

Other changes of note:

  • we no longer ship a cjs build, ESM only is what is published
  • if consumers need to bundle ESM to something, their existing bundlers can configure that.

@NullVoxPopuli NullVoxPopuli force-pushed the remove-local-debug-flags-at-build branch from 12a6e0a to 39290bf Compare October 27, 2023 22:23
@NullVoxPopuli NullVoxPopuli marked this pull request as ready for review October 27, 2023 22:48
@NullVoxPopuli NullVoxPopuli marked this pull request as draft October 27, 2023 23:00
@NullVoxPopuli NullVoxPopuli force-pushed the remove-local-debug-flags-at-build branch from 58de11c to 9afcd9f Compare October 30, 2023 15:48
@NullVoxPopuli NullVoxPopuli marked this pull request as ready for review October 30, 2023 16:23
@@ -20,7 +21,7 @@
"build:control": "rollup -c rollup.config.mjs",
"build:flags": "RETAIN_FLAGS=true ember build --env production --suppress-sizes",
"lint": "npm-run-all lint:*",
"lint:files": "dotenv -- turbo test:lint",
"lint:files": "dotenv -- turbo lint",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lint now depends on publint, which also depends on build.
in another PR, I'll be adding an in-CI turbo server to help with build times

@NullVoxPopuli NullVoxPopuli merged commit 779556a into master Oct 30, 2023
5 checks passed
@NullVoxPopuli NullVoxPopuli deleted the remove-local-debug-flags-at-build branch October 30, 2023 18:51
@NullVoxPopuli
Copy link
Contributor Author

image

@NullVoxPopuli
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant