[英]angular 1.6 es6 es5 browserify “Uncaught Error: [$injector:nomod] Module 'appSuite' is not available!”
I am trying to move an angular 1.6 application from ES5 to ES6. 我正在尝试将一个有角度的1.6应用程序从ES5迁移到ES6。 The index html contains the name of the app: ng-app="appSuite" and we normally reference the individual js files with script tags.
索引html包含应用程序的名称:ng-app =“ appSuite”,我们通常使用脚本标签引用各个js文件。
I've now changed the html to refer to the bundle file which should have all the sources in because I've added imports to the app.module.js .. 现在,我更改了html来引用应该包含所有源的捆绑文件,因为我已经将导入添加到app.module.js中。
We use grunt and I've added babel and browserify steps. 我们使用grunt,我添加了babel和browserify步骤。 The top of the app.module.js now has:
app.module.js的顶部现在具有:
"use strict";
export default appSuite; <<< Is this correct ?
import './access.controller.js';
import './apiClient.service.js';
After Babel it becomes : 巴别塔之后变成:
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
require('./access.controller.js');
Then the browserify changes it to: 然后,browserify将其更改为:
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof
require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var
f=new Error("Cannot find module '"+o+"'");throw
f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o]
[0].call(l.exports,function(e){var n=t[o][1][e];return s(n?
n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof
require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})
({1:
[function(require,module,exports){
"use strict";
(function () {
"use strict";
angular.module("appSuite").controller("accessController", accessController);
Unfortunately when I run it now gives: 不幸的是,当我运行它时,它给出了:
Uncaught Error: [$injector:nomod] Module 'appSuite' is not available!**
Anyone have an idea what I'm missing here or have a way to debug it ? 任何人都知道我在这里缺少什么或有一种调试方法? Thanks in advance and Happy Holidays !
在此先感谢您和节日快乐!
You need to have empty dependencies loaded with your module , 您需要在模块中加载空的依赖项,
const appSuite= angular.module('appSuite', [])
export default appSuite
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.