-2

我没有在我的项目中使用 cli。它使用系统 js 构建器来捆绑东西并使用 node lite 服务来提供内容。我正在尝试弄清楚是否有一种方法可以像常规 cli 项目一样在我的项目中使用环境变量。

喜欢

npm build --prod | dev | test

这是我的构建步骤:

npm build

运行

node build.js

其中包含 systemjs 构建步骤。

var Builder = require('systemjs-builder');

// optional constructor options
// sets the baseURL and loads the configuration file
var builder = new Builder('./', './systemjs.config.js',{ });

builder.buildStatic('./src/main.js', './dist/app.js', { minify: true, sourceMaps: true });

将项目更改为 cli 有点困难。非常感谢任何帮助。

4

1 回答 1

0

想通了。使用 gulp 任务替换我想要在环境文件中的字符串。

于 2018-08-02T21:00:49.283 回答