Registry / web-framework / ember-cli-funnel

ember-cli-funnel

JSON →
library0.6.1jsnpmunverified

`ember-cli-funnel` is an Ember CLI addon designed to exclude specific files or directories from an Ember application's build output. It integrates directly into the `ember-cli-build.js` file, allowing developers to define exclusion patterns using glob syntax within the `EmberApp` configuration. The current stable version, 0.6.1, suggests it's still in a pre-1.0 development phase, implying that its API might not be fully stable, though the core functionality of file funnelling via Broccoli is well-established. Its release cadence appears to be driven by contributions and maintenance, as indicated by a recent dependency update in September 2023 despite the low version number. Key differentiators include its straightforward configuration within the standard Ember build process and its ability to dynamically exclude files based on environment variables or Git branch information, providing fine-grained control over the final build artifact size and content for different deployment targets.

npm install ember-cli-funnel
INSTALL
IMPORT
SIG · EMBER-CLI-FUNNEL
E
ember-cli-funnel
web-frameworkjavascriptv0.6.1
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

EmberApp
✓ const EmberApp = require('ember-cli/lib/broccoli/ember-app');
✗ import EmberApp from 'ember-cli/lib/broccoli/ember-app';
`ember-cli-build.js` files, where `ember-cli-funnel` is configured, traditionally use CommonJS `require` syntax. The addon's functionality is activated by passing a `funnel` option to the `EmberApp` constructor.
funnel (configuration option)
✓ let app = new EmberApp(defaults, { funnel: { exclude: ['some/path/**/*'] } });
✗ import funnel from 'ember-cli-funnel';
The `funnel` property is a specific configuration object understood by the `ember-cli-funnel` addon when present in the `EmberApp` options. It is not a standalone module to be imported directly into your JavaScript files.
getRepoInfo (from git-repo-info)
✓ let getRepoInfo = require('git-repo-info');
✗ import getRepoInfo from 'git-repo-info';
For advanced dynamic exclusions based on Git repository information, `git-repo-info` is an external development dependency that is `require`d in `ember-cli-build.js`.

This quickstart demonstrates how to configure `ember-cli-funnel` within `ember-cli-build.js` to exclude specific application routes and addon styles from the final build output based on glob patterns and environment.

// ember-cli-build.js 'use strict'; const EmberApp = require('ember-cli/lib/broccoli/ember-app'); const path = require('path'); module.exports = function(defaults) { let app = new EmberApp(defaults, { // Configure ember-cli-funnel to exclude specific files from the build funnel: { // Array of glob patterns for files/directories to exclude exclude: [ // Exclude an entire route folder named 'style-guide' from the app's output `${defaults.project.pkg.name}/routes/style-guide/**/*`, // Exclude SCSS files from a specific addon's tree output 'addon-tree-output/some-addon/styles/**/*.scss' ], // The 'enabled' option defaults to true only in production. // Explicitly enable it for other environments if needed. enabled: process.env.EMBER_ENV === 'development' || process.env.EMBER_ENV === 'production' } }); // Return the final Broccoli tree for the build process return app.toTree(); };
Debug
Known issues
gotchaThe `enabled` option for `funnel` defaults to `true` only in `production` environments. If you intend to use file exclusion in `development`, `test`, or other non-production environments, you must explicitly set `enabled: true` in your `ember-cli-build.js` configuration.
fix
Explicitly set `enabled: true` within the `funnel` configuration object in `ember-cli-build.js`: `funnel: { enabled: true, exclude: [...] }`.
affects: >=0.1.0
breakingAs a pre-1.0 release (version 0.6.1), the API and configuration options for `ember-cli-funnel` may be subject to backward-incompatible changes in future minor or patch releases, although no specific breaking changes are documented in the provided README. Developers should be cautious when upgrading within the 0.x range.
fix
Refer to the project's GitHub releases or changelog for specific breaking changes if upgrading within the 0.x range. It is advisable to pin exact versions (e.g., `"ember-cli-funnel": "0.6.1"`) for stability to avoid unexpected breaking changes.
affects: <1.0.0
gotchaIncorrectly defined glob patterns in the `exclude` array can lead to unexpected files being included or excluded, potentially causing runtime errors, build failures, or bloating the build output. Paths are typically relative to the project root or the `addon-tree-output` for files originating from other addons.
fix
Thoroughly test exclusion patterns by running `ember serve` and inspecting the `dist/` directory. Use tools like `glob-explorer` or `tree` to visualize path matching. Pay close attention to the distinction between application-specific file paths and those residing within the `addon-tree-output` directory.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'ember-cli-funnel'
Attempting to `require` or `import` `ember-cli-funnel` directly into an application JavaScript file or even `ember-cli-build.js`.
fix
`ember-cli-funnel` is an Ember CLI addon that extends the `EmberApp` build options. It is not directly imported into JavaScript files. Ensure it is listed in your `package.json` and that `ember install ember-cli-funnel` has been run.
My files aren't being excluded in development! (or other non-production environments)
The `funnel.enabled` option defaults to `true` only in the production environment to optimize development build times.
fix
To apply file exclusions in development or other environments, you must explicitly set `enabled: true` in your `ember-cli-build.js` configuration: `funnel: { enabled: true, exclude: [...] }`.
Build fails or includes unexpected files after upgrading Ember CLI or Node.js versions.
The package, being pre-1.0 and supporting older Node.js engines (`6.* || 8.* || >= 10.*`), may have underlying Broccoli dependencies or integration mechanisms with `EmberApp` that are not fully compatible with newer Ember CLI or Node.js versions without updates.
fix
Check the `ember-cli-funnel` GitHub issues and pull requests for any known compatibility issues or updates required for your specific Ember CLI and Node.js versions. Consider using `ember try:each` to test against multiple Ember versions to identify the breaking point.
Upgrade
Version history
0.6.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
ember-cli-funnel — npm install ember-cli-funnel · libregistry