我正在尝试为我的应用程序配置splitChunks,但是在构建时,出现错误$injector:modulerr
webpack.config
const result = {
module: {
rules: [
{
test: /\.ts$/,
exclude: [ /node_modules/ ],
use: [
'ng-annotate-loader',
'awesome-typescript-loader'
]
},
]
},
optimization: {
runtimeChunk: true,
splitChunks: {
chunks: 'all',
maxInitialRequests: Infinity,
minSize:
},
},
plugins: [
new ExtractTextPlugin({
// filename: './css/style.bundle.css',
allChunks: true,
}),
new ngAnnotatePlugin({
add: true,
}),
],
};
return result;
}
module.exports = getConfig(NODE_ENV);
app.ts
function getModulesName() {
return [
'ngAnimate',
'ui.bootstrap',
'ngResource',
'ngSanitize',
'ui.router',
'pascalprecht.translate',
'ngMessages',
'LocalStorageModule',
'toaster',
];
const coreApp = angular.module(coreAppName, getModulesName());
....
coreApp.run([
'$http',
'authenticationService',
'$state',
'$rootScope',
'$log',
($http: IHttpService, authenticationService: AuthenticationService, $state, $rootScope, $log) => {}
.config(stateConfig)
....
}
state.config
export function stateConfig($stateProvider: ng.ui.IStateProvider,
$urlRouterProvider: any,
$locationProvider: ILocationProvider) {
$urlRouterProvider
.when(...)
.otherwise(...);
$stateProvider
.state(...)
$locationProvider.html5Mode(true);
}
stateConfig.$inject = ['$stateProvider', '$urlRouterProvider', '$locationProvider'];
据我了解,它与Webpack的应用程序构建功能有关,并且注入器无法正常工作,但我不知道如何解决该错误
请帮助解决此错误