K
K
Klein Maximus2017-07-21 14:01:27
Node.js
Klein Maximus, 2017-07-21 14:01:27

How to change file for import when using webpack?

Some file contains:
import Api from 'api';
How to set up webpack so that when process.env.NODE_ENV === 'production' 'api' is imported, and when process.env.NODE_ENV !== 'production' it is replaced with, for example, 'mock'?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Klein Maximus, 2017-07-21
@kleinmaximus

You need to use resolve.alias

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question