簡體   English   中英

angular 1.6 es6 es5 browserify“未捕獲的錯誤:[$ injector:nomod]模塊'appSuite'不可用!”

[英]angular 1.6 es6 es5 browserify “Uncaught Error: [$injector:nomod] Module 'appSuite' is not available!”

我正在嘗試將一個有角度的1.6應用程序從ES5遷移到ES6。 索引html包含應用程序的名稱:ng-app =“ appSuite”,我們通常使用腳本標簽引用各個js文件。

現在,我更改了html來引用應該包含所有源的捆綁文件,因為我已經將導入添加到app.module.js中。

我們使用grunt,我添加了babel和browserify步驟。 app.module.js的頂部現在具有:

"use strict";
export default appSuite;             <<< Is this correct ?
import './access.controller.js';
import './apiClient.service.js';

巴別塔之后變成:

"use strict";

Object.defineProperty(exports, "__esModule", {
    value: true
});

require('./access.controller.js');

然后,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);

不幸的是,當我運行它時,它給出了:

Uncaught Error: [$injector:nomod] Module 'appSuite' is not available!**

任何人都知道我在這里缺少什么或有一種調試方法? 在此先感謝您和節日快樂!

您需要在模塊中加載空的依賴項,

const appSuite= angular.module('appSuite', [])
export default appSuite

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM