Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,20 @@ function sharedESMConfig({ input, debugMacrosMode, includePackageMeta = false })
return {
onLog: handleRollupWarnings,
input,
treeshake: {
moduleSideEffects(id) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I feel like very few of our modules actually have side effects and wonder if we can't invert this and only list the things that do have side effects, rather than listing some things that don't.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yea, I'll experiment with that next -- would be good information to have ahead of #21365

the "side-effects tests" we have also flag rollup's "hoisted imports", which is kind of annoying, but something I also need to look in to

if (id.includes('packages/@glimmer/debug')) return false;
if (id.includes('packages/@glimmer/env')) return false;
if (id.includes('packages/@glimmer/local-debug-flags')) return false;
if (!debugMacrosMode && id.includes('packages/@ember/debug')) return false;

/**
* our own side-effects are not for us to decide when to remove
* (aside from those incurred from the develop/prod split)
*/
return true;
},
},
output: {
format: 'es',
dir: outputDir,
Expand Down
26 changes: 13 additions & 13 deletions tests/node-vitest/tree-shakability.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ it('[prod] has expected tree-shakable entrypoints', async () => {
[
"ember-source/@ember/-internals/browser-environment/index.js",
"ember-source/@ember/-internals/error-handling/index.js",
"ember-source/@ember/-internals/meta/index.js",
"ember-source/@ember/-internals/meta/lib/meta.js",
"ember-source/@ember/-internals/owner/index.js",
"ember-source/@ember/-internals/string/index.js",
"ember-source/@ember/-internals/utility-types/index.js",
Expand All @@ -254,16 +256,27 @@ it('[prod] has expected tree-shakable entrypoints', async () => {
"ember-source/@ember/reactive/index.js",
"ember-source/@ember/routing/lib/cache.js",
"ember-source/@ember/routing/lib/controller_for.js",
"ember-source/@ember/routing/lib/dsl.js",
"ember-source/@ember/routing/lib/location-utils.js",
"ember-source/@ember/routing/lib/query_params.js",
"ember-source/@ember/template-compilation/index.js",
"ember-source/@ember/template-compiler/-internal-primitives.js",
"ember-source/@ember/template-compiler/-internal-utils.js",
"ember-source/@ember/template-compiler/lib/-internal/primitives.js",
"ember-source/@ember/template-compiler/lib/dasherize-component-name.js",
"ember-source/@ember/template-compiler/lib/plugins/allowed-globals.js",
"ember-source/@ember/template-compiler/lib/plugins/assert-against-attrs.js",
"ember-source/@ember/template-compiler/lib/plugins/assert-against-named-outlets.js",
"ember-source/@ember/template-compiler/lib/plugins/assert-input-helper-without-block.js",
"ember-source/@ember/template-compiler/lib/plugins/assert-reserved-named-arguments.js",
"ember-source/@ember/template-compiler/lib/plugins/auto-import-builtins.js",
"ember-source/@ember/template-compiler/lib/plugins/index.js",
"ember-source/@ember/template-compiler/lib/plugins/transform-action-syntax.js",
"ember-source/@ember/template-compiler/lib/plugins/transform-each-in-into-each.js",
"ember-source/@ember/template-compiler/lib/plugins/transform-each-track-array.js",
"ember-source/@ember/template-compiler/lib/plugins/transform-in-element.js",
"ember-source/@ember/template-compiler/lib/plugins/transform-quoted-bindings-into-just-bindings.js",
"ember-source/@ember/template-compiler/lib/plugins/transform-resolutions.js",
"ember-source/@ember/template-compiler/lib/plugins/transform-wrap-mount-and-outlet.js",
"ember-source/@ember/template-compiler/lib/plugins/utils.js",
"ember-source/@ember/template-compiler/lib/system/calculate-location-display.js",
Expand Down Expand Up @@ -298,8 +311,6 @@ it('[prod] has expected tree-shakable entrypoints', async () => {
"ember-source/@ember/-internals/deprecations/index.js",
"ember-source/@ember/-internals/environment/index.js",
"ember-source/@ember/-internals/glimmer/index.js",
"ember-source/@ember/-internals/meta/index.js",
"ember-source/@ember/-internals/meta/lib/meta.js",
"ember-source/@ember/-internals/metal/index.js",
"ember-source/@ember/-internals/routing/index.js",
"ember-source/@ember/-internals/runtime/index.js",
Expand Down Expand Up @@ -362,7 +373,6 @@ it('[prod] has expected tree-shakable entrypoints', async () => {
"ember-source/@ember/routing/hash-location.js",
"ember-source/@ember/routing/history-location.js",
"ember-source/@ember/routing/index.js",
"ember-source/@ember/routing/lib/dsl.js",
"ember-source/@ember/routing/lib/generate_controller.js",
"ember-source/@ember/routing/lib/router_state.js",
"ember-source/@ember/routing/lib/routing-service.js",
Expand All @@ -373,18 +383,8 @@ it('[prod] has expected tree-shakable entrypoints', async () => {
"ember-source/@ember/routing/router.js",
"ember-source/@ember/runloop/index.js",
"ember-source/@ember/service/index.js",
"ember-source/@ember/template-compiler/-internal-primitives.js",
"ember-source/@ember/template-compiler/index.js",
"ember-source/@ember/template-compiler/lib/-internal/primitives.js",
"ember-source/@ember/template-compiler/lib/compile-options.js",
"ember-source/@ember/template-compiler/lib/plugins/assert-against-attrs.js",
"ember-source/@ember/template-compiler/lib/plugins/assert-against-named-outlets.js",
"ember-source/@ember/template-compiler/lib/plugins/assert-input-helper-without-block.js",
"ember-source/@ember/template-compiler/lib/plugins/assert-reserved-named-arguments.js",
"ember-source/@ember/template-compiler/lib/plugins/index.js",
"ember-source/@ember/template-compiler/lib/plugins/transform-each-track-array.js",
"ember-source/@ember/template-compiler/lib/plugins/transform-in-element.js",
"ember-source/@ember/template-compiler/lib/plugins/transform-resolutions.js",
"ember-source/@ember/template-compiler/lib/public-api.js",
"ember-source/@ember/template-compiler/lib/runtime.js",
"ember-source/@ember/template-compiler/lib/template.js",
Expand Down
Loading