繁体   English   中英

Angular4 + MVC + cli +使用cli build命令生成的dist文件夹进行部署

[英]Angular4 + MVC + cli + deployment using dist folder generated from cli build command

我有一个angular4 + MVC项目。

我在cli中通过ng build --prod命令生成了一个dist文件夹。

我想消除节点模块并仅检查这些dist文件以进行生产。

我的问题是如何指向使用/ dist文件夹而不是/ node模块开始执行。

目前我正在使用我的layout.cshtml(在mvc中)中的system.import()来导入角度的app模块。

 <script>
System.import('app/main.js').catch(function (err) { console.error(err); });

还有什么应该是systemjs.config文件中的内容,因为我的目的是消除节点模块,目前** systemjs.config **指向打开节点模块文件夹。

(function (global) {System.config({
paths: {
  'npm:': 'node_modules/'
},
map: {
  'app': 'app',
  '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
  '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
  '@angular/animations': 'npm:@angular/animations/bundles/animations.umd.js',
  '@angular/animations/browser': 'npm:@angular/animations/bundles/animations-browser.umd.js',
  '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
  '@angular/platform-browser/animations': 'npm:@angular/platform-browser/bundles/platform-browser-animations.umd.js',

等等

任何帮助将受到高度赞赏。

所有关于你的构建中的index.html - 它包含你所有的脚本部分和polyfill

只需将您的index.html从dist文件夹添加到您的cshtml文件,并将您的脚本和样式映射到您构建的文件夹

您只需要部署您的prod构建,只需要 - 您可以排除节点模块并检入更改

谢谢 !! 快乐的编码

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM