在webpack上删除InMemoryWebApiModule以获取角度项目的prod配置

时间:2017-11-08 09:32:22

标签: angular webpack-dev-server webpack-2

我使用InMemoryWebApiModule在dev上模拟我的数据,但不希望它用于prod。是否有任何技术不用于webpack上的prod? atm我尝试使用webpack-strip-block删除webpack.prod配置中的导入,但无法使其正常工作。有没有人知道如何去做呢?

1 个答案:

答案 0 :(得分:0)

我尝试了这个技巧,它适用于我的情况。我没有从webpack处理它,而是改变了我们为主模块提供相应提供者的方式,

[INFO] -------------------------------------------------------------
[WARNING] COMPILATION WARNING :
[INFO] -------------------------------------------------------------
[WARNING] 
\myfiles.java:[8,24] DerInputStream is internal pro
prietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[9,24] DerOutputStream is internal pr
oprietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[10,24] DerValue is internal propriet
ary I and may be removed in a future release
[WARNING] 
\myfiles.java:[11,24] AlgorithmId is internal propr
ietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[13,24] CertificateAlgorithmId is int
ernal proprietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[14,24] CertificateIssuerName is inte
rnal proprietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[15,24] CertificateSerialNumber is in
ternal proprietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[16,24] CertificateSubjectName is int
ernal proprietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[17,24] CertificateValidity is intern
al proprietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[18,24] CertificateVersion is interna
l proprietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[19,24] CertificateX509Key is interna
l proprietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[20,24] X500Name is internal propriet
ary I and may be removed in a future release
[WARNING] 
\myfiles.java:[21,24] X509CertImpl is internal prop
rietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[22,24] X509CertInfo is internal prop
rietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[23,24] X509Key is internal proprieta
ry I and may be removed in a future release
[WARNING] 
\myfiles.java:[62,8] X500Name is internal proprieta
ry I and may be removed in a future release
[WARNING] 
\myfiles.java:[62,31] X500Name is internal propriet
ary I and may be removed in a future release
[WARNING] 
\myfiles.java:[94,8] X509CertInfo is internal propr
ietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[95,35] CertificateIssuerName is inte
rnal proprietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[95,61] X500Name is internal propriet
ary I and may be removed in a future release
[WARNING] 
\myfiles.java:[96,37] CertificateValidity is intern
al proprietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[97,41] CertificateSerialNumber is in
ternal proprietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[99,8] AlgorithmId is internal propri
etary I and may be removed in a future release
[WARNING] 
\myfiles.java:[101,24] AlgorithmId is internal prop
rietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[101,36] AlgorithmId is internal prop
rietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[103,24] AlgorithmId is internal prop
rietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[103,36] AlgorithmId is internal prop
rietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[105,40] CertificateAlgorithmId is in
ternal proprietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[107,8] X509CertImpl is internal prop
rietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[107,32] X509CertImpl is internal pro
prietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[121,19] X509CertInfo is internal pro
prietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[134,8] DerValue is internal propriet
ary I and may be removed in a future release
[WARNING] 
\myfiles.java:[134,32] DerValue is internal proprie
tary I and may be removed in a future release
[WARNING] 
\myfiles.java:[135,8] DerInputStream is internal pr
oprietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[135,32] DerInputStream is internal p
roprietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[136,8] DerValue is internal propriet
ary I and may be removed in a future release
[WARNING] 
\myfiles.java:[138,8] DerValue is internal propriet
ary I and may be removed in a future release
[WARNING] 
\myfiles.java:[138,40] DerInputStream is internal p
roprietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[146,8] X500Name is internal propriet
ary I and may be removed in a future release
[WARNING] 
\myfiles.java:[146,35] X500Name is internal proprie
tary I and may be removed in a future release
[WARNING] 
\myfiles.java:[147,41] X509Key is internal propriet
ary I and may be removed in a future release
[WARNING] 
\myfiles.java:[154,8] AlgorithmId is internal propr
ietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[154,34] AlgorithmId is internal prop
rietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[161,8] DerOutputStream is internal p
roprietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[161,37] DerOutputStream is internal
proprietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[162,8] DerOutputStream is internal p
roprietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[162,38] DerOutputStream is internal
proprietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[163,8] DerOutputStream is internal p
roprietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[163,34] DerOutputStream is internal
proprietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[175,8] DerOutputStream is internal p
roprietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[175,38] DerOutputStream is internal
proprietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[177,30] DerValue is internal proprie
tary I and may be removed in a future release
[WARNING] 
\myfiles.java:[190,8] X509CertInfo is internal prop
rietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[190,32] X509CertInfo is internal pro
prietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[192,32] CertificateVersion is intern
al proprietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[193,32] CertificateSubjectName is in
ternal proprietary I and may be removed in a future release
[WARNING] 
\myfiles.java:[194,28] CertificateX509Key is intern
al proprietary I and may be removed in a future release
[INFO] 57 warnings

在我的提供程序中,我首先检查生产环境,然后提供providers数组。我已经实现了拦截器方法来完成后端更少的开发,并且当环境生产时我没有注入完整的提供者列表,否则我将为非生产环境提供。

我检查了environment.production(这对于生产环境是正确的,否则将是假的,因此我将拥有我希望运送到生产的代码。