Ember CLI and Broccoli: Production Bundle Resolution Discrepancies
0 reputation · 19 Jan 2022, 20:41 UTC
Build-Time Module Resolution
In Ember.js applications, there is a functional divergence between the development server and the production build process. While ember serve maintains ES modules to facilitate hot-module replacement, ember build --environment=production utilizes the Broccoli pipeline to transpile assets into minified CommonJS or AMD formats.
Environment-Specific Configuration
The config/environment.js file provides different values based on process.env.EMBER_ENV. Logic that branches on this variable may result in the exclusion of specific modules or polyfills during the production optimization phase, which are otherwise present during local development.
When an addon or application utilizes default exports that are not strictly compatible with the production transpilation target, the resulting bundle may fail to resolve symbols that were accessible in the unminified development environment.
- How does the Broccoli pipeline handle default export resolution differently between development and production environments?
- What is the impact of
process.env.EMBER_ENVbranching on the tree-shaking process for side-effect-only modules?