我正在尝试将我们的 angular.js 构建从 gulp 移动到 webpack。我已经成功地捆绑了供应商库,但我遇到了 angular.js 模块的问题。
未捕获的错误:[$injector:modulerr] 无法实例化模块应用程序,因为:错误:[$injector:modulerr] 无法实例化模块 app.product 由于:错误:[$injector:nomod] 模块“app.product”是无法使用!您拼错了模块名称或忘记加载它。如果注册模块,请确保将依赖项指定为第二个参数。
我应该如何导入它们以便 webpack 选择它们?
webpack.config.js
const webpack = require('webpack'),
path = require('path'),
config = require('./config.json');
module.exports = {
entry: './app/app.js',
mode: 'development',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js'
},
plugins: [
new webpack.DefinePlugin({
PRODUCTION: JSON.stringify(false),
VERSION: JSON.stringify(config.version),
INTERCOME_ENABLED: JSON.stringify(true),
})
],
};
模块初始化
angular.module('app.product', [
]);
angular.module('app.product', ['app.config'])
.provider('product', function (CONST) {
(rest of the function)
郎朗坤
慕码人2483693
随时随地看视频慕课网APP
相关分类