Javascript AngularJS+;网页包热模块替换忽略app.controllers中的更改

Javascript AngularJS+;网页包热模块替换忽略app.controllers中的更改,javascript,angularjs,webpack,hot-reload,Javascript,Angularjs,Webpack,Hot Reload,我已经在我的AngularJS 1.7.2项目中实现了Webpack HMR。 如果我更改了.js文件中的某些内容并保存了,我会在不刷新的情况下进行热更新 然而,所有东西都位于app.controller下,或者AngularJS制作的任何其他东西都不起作用 例如: module.exports = app => { console.log(1); // will be hot updated app.controller("myCtrl", () => console.lo

我已经在我的AngularJS 1.7.2项目中实现了Webpack HMR。 如果我更改了.js文件中的某些内容并保存了,我会在不刷新的情况下进行热更新

然而,所有东西都位于app.controller下,或者AngularJS制作的任何其他东西都不起作用

例如:

module.exports = app => {

 console.log(1); // will be hot updated

 app.controller("myCtrl", () => console.log(2)); // will not update in case I change the 2 to 3, or something else.

}
这是webpack.config.js文件:

const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');

module.exports = (env, argv) => {
  return {
    entry: './src/webpack.entry.js',
    output: {
      filename: 'bundle.js',
      chunkFilename: '[name].bundle.js',
      path: path.resolve(__dirname, './www')
    },
    plugins: [
      // new HtmlWebpackPlugin({
      //   template: "./src/index.html"
      // }),
      new webpack.HotModuleReplacementPlugin()
    ],
    devServer: {
      contentBase: path.resolve(__dirname, './www'),
      hot: true,
      inline: true
    },
    // devtool: argv.mode == "development" ? 'inline-source-map' : false,
    module: {
      rules: [
        {
          test: /\.(html)$/,
          exclude: /node_modules/,
          use: {
            loader: 'html-loader',
            options: {
              attrs: [':data-src']
            }
          }
        },
        {
          test: /\.(woff(2)?|ttf|eot|svg|jpg|jpeg|png|jpg|gif)$/,
          exclude: /node_modules/,
          use: [
            {
              loader: 'file-loader',
              options: {}
            }
          ]
        },
        {
          test: /\.css$/,
          exclude: /node_modules/,
          use: [
            'style-loader',
            'css-loader',
          ]
        },
        // {
        //   test: /\.scss$/,
        //   exclude: /node_modules/,
        //   use: [
        //     'sass-loader'
        //   ]
        // }
      ]
    },
    optimization: {
      minimize: false
    }
  };
}
我还想提供webpack.entry.js文件:

// angularjs app first initialization
var app = require('./app/app');

// ionic core css
require('./assets/css/ionic.bundle.css');

// app scripts
require('./app/index')(app);

// screens scripts
require('./screens/index')(app);

// assets
require('./assets/css/custom-both.css');

// NOTE: without this, it fully reloads the webpage instead of making it hot reload - even when the config sets with hot:true
if (module.hot) {
  module.hot.accept();
}