Web包未将javascript注入cshtml

Web包未将javascript注入cshtml,javascript,asp.net-mvc,webpack,html-webpack-plugin,Javascript,Asp.net Mvc,Webpack,Html Webpack Plugin,嗨,我有一个MVC5项目,有很多javascript前端代码。所以我决定将这些javascript模块化==>将它们注入cshtml模板==>在我的视图中呈现它们 我的配置: webpack.config.js module.exports = { entry: { layout: './Public/js/Layout.js', index: './ViewModules/Home/Index.js', noisoisieuam: './ViewModules/Ke

嗨,我有一个MVC5项目,有很多javascript前端代码。所以我决定将这些javascript模块化==>将它们注入cshtml模板==>在我的视图中呈现它们 我的配置:

webpack.config.js

module.exports = {
entry: {
    layout: './Public/js/Layout.js', 
    index: './ViewModules/Home/Index.js',
    noisoisieuam: './ViewModules/KetQua/NoiSoiSieuAm.js'
},
output: {
    path: path.resolve(__dirname, './Public/Output'),
    filename: '[name].bundle.[contenthash].js',
},
plugins: [
    new HtmlWebpackPlugin({
        inject: true,
        templateContent: '',
        filename: '../../../ViewModules/Shared/_Layout.temp.cshtml',
        chunks: [ 'layout']
    }),
    new HtmlWebpackPlugin({
        inject: true, 
        templateContent: '',
        filename: '../../../ViewModules/Home/Index.temp.cshtml',
        chunks: ['index']
    }),
    new HtmlWebpackPlugin({
        inject: true, 
        templateContent: '',
        filename: '../../../ViewModules/KetQua/NoiSoiSieuAm.temp.cshtml',
        chunks: ['noisoisieuam']
    })
],
// IMPORTANT NOTE: If you are using Webpack 2 or above, replace "loaders" with "rules"
module: {
    rules: [
        {
            use: [
                {
                    loader: 'babel-loader',
                    options: {
                        presets: ["@babel/preset-env"]
                        }
                }
            ],
            test: /\.js$/,
            exclude: /node_modules/
        },
        {
            test: /\.json$/,
            type: 'javascript/auto',
            use: [
                {
                    loader: 'file-loader',
                    options: {
                        name: "[path][name].[ext]"
                    }
                }
            ],                
        }
    ]
}
}

*.temp.cshtml
文件是空的cshtml文件,仅用于javascript注入。 我各自的*.cshtml中的代码(我的视图):

。。。
@Html.Partial(“~/ViewModules//*.temp.cshtml”)
...
问题是webpack(我的主页和
\u布局)只注入了前2个temp.cshtml

npm运行build
或在visualstudio中构建不会给出任何错误。这些javascript包都是创建的。
'noiseoiuam'
块未注入我的temp.cshtml

我怎样才能解决这个问题?多谢各位

    ...
@Html.Partial("~/ViewModules/<path-to-template>/*.temp.cshtml")
...