1

I have two libraries which i use in my angular application that are great for local development but should not go up into our production builds.

The two libraries are angular-in-memory-web-api and @ngrx/store-devtools

These libraries must be imported into the app.module

Is there a way to have these two imports removed when i go to make a production build or do i need to keep removing them manually on release?

2
  • r u using angular-cli? Commented Nov 10, 2016 at 4:33
  • No i have not moved over to that i am using the starter app from antony budianto StarterIf i did move to the cli what is the process then because this would need to be removed from the ngModule Commented Nov 10, 2016 at 16:07

2 Answers 2

1

I solved this using the angular cli environments files.

I was able to create an Environment Module that i could import into the app.module which contains all the development libraries.

Sign up to request clarification or add additional context in comments.

Comments

0

You should be installing them as dev dependencies using 'npm install pkg --dev' then I imagine a production build would not include those depencies 'ng build --prod'.

Maybe you could import these into environment.dev.ts and access the environment.ts file from your app.module.ts. In you environment.prod.ts just leave these imports out and have your app.module.ts not use them if it returns undefined from environment.ts

1 Comment

these are imported as moduels, making them as dev dependencies will not work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.