我尝试在 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"
}
}
暮色呼如
相关分类