Webpack html 输出位置

Webpack html output location

我的webpack配置如下

const webdirectory = "../Application/Web"
plugins: [
                new HtmlWebpackPlugin({
                    inject: "body",
                    filename: `${webdirectory}/Views/Health/Index.cshtml`,
                    template: `${webdirectory}/Views/Health/Index_Template.cshtml`,
                    minify: false
                }),

output: {
                // assets served by webpack-dev-server
                path: path.resolve(__dirname, "IGNOREdevjunk/"),
                publicPath: "https://localhost:8080/"
              },

我希望 webpack 在与从中获取模板的文件夹相同的文件夹中生成 cshtml。但是 webpack 做了什么,它从正确的位置抓取模板,但是当它保存 cshtml 时,它完全弄乱了输出目录。它所做的是获取 'path' 变量 VALUE,在本例中为 'Client',然后在 Client/IGNOREdevjunk/Application/Web/Views/Health/Index.cshtml

中创建 cshtml

如何将 cshtml 保存在与模板相同的文件夹中?保存时忽略相对路径。

目录结构

Parent
 - Application
 - - Web
 - - - Views
 - - - - Health
 - - - - - Index_template.cshtml
 - - - - - Index.cshtml (THIS IS WHERE I WANT THE CSHTML TO BE EMITTED)
 - Client
 - webpack.config.js
 - - IGNOREdevjunk
 - - - Application
 - - - - Web
 - - - - - Views
 - - - - - - Health
  - - - -  - - Index.cshtml (I DON'T WANT THIS SAVED HERE)

以下对我有用

我不得不更改文件名如下

const webdirectory = "../Application/Web"
plugins: [
                new HtmlWebpackPlugin({
                    inject: "body",
                    filename: path.join(__dirname, "../Application/Web/Views/Health/Index.cshtml"),
                    template: `${webdirectory}/Views/Health/Index_Template.cshtml`,
                    minify: false
                }),

output: {
                // assets served by webpack-dev-server
                path: path.resolve(__dirname, "IGNOREdevjunk/"),
                publicPath: "https://localhost:8080/"
              },