Angularjs 在没有ES6的情况下为angular应用程序使用网页包。TypeError:无法读取属性';呼叫';未定义的

Angularjs 在没有ES6的情况下为angular应用程序使用网页包。TypeError:无法读取属性';呼叫';未定义的,angularjs,webpack,Angularjs,Webpack,我正在尝试转换我们的Angular应用程序,它使用Grunt来使用webpack 我得到了以下错误 Uncaught TypeError: Cannot read property 'call' of undefined__webpack_require__ @ bootstrap 9b19609cd4b35f075583:50(anonymous function) @ vendor.js:5__webpack_require__ @ bootstrap 9b19609cd4b35f07558

我正在尝试转换我们的Angular应用程序,它使用Grunt来使用webpack

我得到了以下错误

Uncaught TypeError: Cannot read property 'call' of undefined__webpack_require__ @ bootstrap 9b19609cd4b35f075583:50(anonymous function) @ vendor.js:5__webpack_require__ @ bootstrap 9b19609cd4b35f075583:50webpackJsonpCallback @ bootstrap 9b19609cd4b35f075583:21(anonymous function) @ vendor.js:1
这是我的bootstrap.js

'use strict';

require('./vendor')();

var appModule = require('./app');

angular.element(document).ready(function () {
    console.log('App Module Name=['+appModule.name+']');
    angular.bootstrap(document, [appModule.name], {

    });
});
和我的vendor.js文件

module.exports = function(){
    require('angular');
}
我的webpack.config.js文件

var webpack = require('webpack');
var path = require('path');

var APP  = __dirname + '/src';

module.exports = {

    resolveLoader: {
        root: path.join(__dirname,'node_modules')
    },
    context  : APP,
    entry : {
       app : ['webpack/hot/dev-server', './app/bootstrap.js']
    },
    devtool: 'source-map',
    output: {
        path: APP,
        filename: 'bundle.js'
    },

    devServer: {
        contentBase : './dist',
        colors:true,
        histroryApiFallback :true,
        inline: true
    },
    plugins: [
        new webpack.HotModuleReplacementPlugin()
    ],
    module:{
        loaders:[
            {test: /\.js$/, loader: 'exports?angular'},
            {test: /\.tpl\.html$/, loader: 'raw'},
            {test: /\.jpg$/, loader: 'file-loader'},
            {test: /\.css$/, loader: 'style!css'},
            {test: /\.less$/, loader: 'style!css!less'}
        ]
    }

};
在开发人员控制台中,这里是我得到错误的地方:

// Execute the module function
        modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
我不知道我做错了什么


谢谢

我将webpack.config.js中的加载程序更改为{test:/\.js$/,加载程序:'imports?angular'},然后我得到错误Uncaught TypeError:angular.module不是函数!!您是否明确不想使用ES6?是的,它是一个现有的应用程序,我们还不想在ES6中重写它。它使用了grunt并想迁移到webpack。你知道你仍然可以使用Babel loader等,而不必编写ES6