我尝试在 ASP.NET Core 项目中使用 webpack这是我的 Startup.cs 文件和 Configure 类public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions { HotModuleReplacement = true }); } else { app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }这是我的 package.json 文件 { "name": "streamline", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "wbp": "webpack" }, "keywords": [], "author": "", "license": "ISC", "devDependencies": { "aspnet-webpack": "^3.0.0", "bootstrap": "^4.1.2", "css-loader": "^1.0.0", "extract-text-webpack-plugin": "^4.0.0-beta.0", "jquery": "^3.3.1", "popper.js": "^1.14.3", "style-loader": "^0.21.0", "uglifyjs-webpack-plugin": "^1.2.7", "webpack": "^4.16.1", "webpack-cli": "^3.0.8", "webpack-hot-middleware": "^2.22.2" }, "dependencies": { "@babel/core": "^7.0.0-beta.53", "@babel/preset-env": "^7.0.0-beta.53", "babel-loader": "^8.0.0-beta.4" }}
1 回答
暮色呼如
TA贡献1853条经验 获得超9个赞
我有同样的问题。为我解决...
npm install --save-dev webpack-cli
这给了我线索 npm WARN aspnet-webpack@3.0.0 requires an peer of webpack-dev-middleware @^1.8.4 || ^3.0.0 但没有安装。您必须自己安装对等依赖项。npm WARN acesweb@1.0.0 没有存储库字段。
然后..
npm install --save-dev webpack-dev-middleware
现在它运行并且工作正常。
- 1 回答
- 0 关注
- 266 浏览
添加回答
举报
0/150
提交
取消