2016-12-30 134 views
6

我有一個ASP.NET Core現場用2個頁面,該頁面路由通過MVC,不Angular 2完成。每個頁面都有自己的Angular 2「應用程序」。我正在努力嘗試使用webpack來解決這個問題。的WebPack多角度2個模塊

如果我引導兩個部件爲一個模塊,然後我得到一個The selector "xxx" did not match any elements錯誤。不過,如果我嘗試在webpack.config.js創建多個entry當時的該polyfills怪胎,因爲它是無法找到其他模塊。

我如何得到這個工作?我在這裏唯一可用的選擇是被迫使用Angular 2路由器並創建一個SPA?

這裏是我的webpack.config.js相關部分:

entry: { 
    "polyfills": "./App/polyfills.ts", 
    "vendor": "./App/vendor.ts", 
    "firstapp": "./App/bootfirst.ts", 
    "secondapp": "./App/bootsecond.ts" 
}, 
resolve: { 
    extensions: ['', '.ts', '.js', '.json', '.css', '.scss', '.html'] 
}, 
output: { 
    path: process.cwd() + "/wwwroot", 
    publicPath: "/js/", 
    filename: "js/[name].js" 
}, 
+0

您是否找到任何解決方案? – Ssss

回答

1

可悲的是,我不得不使用這種暴行繼續下去。請有人幫我找到正確的解決方案。

entry: { 
    "polyfills": "./App/polyfills.ts", 
    "vendor": "./App/vendor.ts", 
    "app": "./App/bootfirst.ts" 
    //"app": "./App/bootsecond.ts" 
}, 
resolve: { 
    extensions: ['', '.ts', '.js', '.json', '.css', '.scss', '.html'] 
}, 
output: { 
    path: process.cwd() + "/wwwroot", 
    publicPath: "/js/", 
    filename: "js/[name].first.js" 
    //filename: "js/[name].second.js" 
},