angular - 在没有 Angular CLI 的情况下使用环境变量
问题描述
我没有在我的项目中使用 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 有点困难。非常感谢任何帮助。
解决方案
想通了。使用 gulp 任务替换我想要在环境文件中的字符串。
推荐阅读
- javascript - 嵌套可观察对象和以角度加载内容的问题
- sql-server - Microsoft SQL Server Management Studio 未显示要编辑的前 200 行
- javascript - JavaScript 异步函数执行顺序
- javascript - 使用 mongoose 连接到 mongoDB 的未处理的承诺拒绝警告
- r - 如何使用 n 为类别创建 tibble
- ibm-watson - Watson Studio 无法通过添加新存储来创建空项目
- spring - 为什么此处理程序方法(/trying)返回错误 404 而不是将请求发送到另一个处理程序方法 /addpage
- asp.net-mvc - 身份验证 Cookie 在第 3 方 iframe 中不起作用
- php - 使用 php 在 GitLab 中上传文件时遇到问题
- flutter - 使用 modal_bottom_sheet 如何通过文本字段输入重新创建 SingleChildScrollView 的功能?