# Remove dependency optionally at build time

**URL:** https://discuss.emberjs.com/t/remove-dependency-optionally-at-build-time/17007
**Category:** Uncategorized
**Created:** [August 29, 2019, 1:42am UTC](https://discuss.emberjs.com/t/remove-dependency-optionally-at-build-time/17007 "2019-08-29T01:42:03Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Scott\_Newcomer](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/scott_newcomer/32/13468_2.png) [@Scott\_Newcomer](https://discuss.emberjs.com/u/Scott_Newcomer)
#### Post date: [August 29, 2019, 1:42am UTC](https://discuss.emberjs.com/t/remove-dependency-optionally-at-build-time/17007/1 "2019-08-29T01:42:04Z")

</div>

I’m looking into removing a dependency at build time based on an environmental variable from process.env.

Looked at a few things:

1. blacklist - doesn’t strip it from vendor.js
2. Prod code only? - [Remove a particular file/folder from the app tree depends upon the build environment](https://discuss.emberjs.com/t/remove-a-particular-file-folder-from-the-app-tree-depends-upon-the-build-environment/14635)

Is there a way to remove a dependency at build time in either `ember-cli-build` or does it have to be encapsulated in a separate addon?

---

<div class="post-metadata">

### Author: ![efx](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/efx/32/17920_2.png) [@efx](https://discuss.emberjs.com/u/efx)
#### Post date: [August 30, 2019, 5:24pm UTC](https://discuss.emberjs.com/t/remove-dependency-optionally-at-build-time/17007/2 "2019-08-30T17:24:42Z")

</div>

I’ve done the inverse by only including a test file based on the environment:

```nohighlight
// snippet from ember-cli-build
        const environment = EmberApp.env();
	const isTest = environment === 'test';
	if (isTest) {
		app.import('vendor/fixtures/my-test-file.csv', {type: 'test'});
	}

```

This doesn’t answer your question directly but may help provide an opt-in scenario. Where is the dependency coming from too? The app, `node_modules`, or somewhere else?

---

<div class="post-metadata">

### Author: ![Scott\_Newcomer](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/scott_newcomer/32/13468_2.png) [@Scott\_Newcomer](https://discuss.emberjs.com/u/Scott_Newcomer)
#### Post date: [August 31, 2019, 2:15pm UTC](https://discuss.emberjs.com/t/remove-dependency-optionally-at-build-time/17007/3 "2019-08-31T14:15:18Z")

</div>

This is wrong. `blacklist` does strip it from vendor.js.

---

<div class="post-metadata">

### Author: ![Scott\_Newcomer](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/scott_newcomer/32/13468_2.png) [@Scott\_Newcomer](https://discuss.emberjs.com/u/Scott_Newcomer)
#### Post date: [August 31, 2019, 2:15pm UTC](https://discuss.emberjs.com/t/remove-dependency-optionally-at-build-time/17007/4 "2019-08-31T14:15:49Z")

</div>

This is another good thing to know! Thank you!
