[英]Include files to build generated by angular-cli before build in asp.net mvc
[英]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.