Babel“babel-plugin-angularjs-annotate插件”不适用于JSPM

时间:2018-06-03 12:25:38

标签: javascript angularjs npm babel jspm

我正在尝试使用jspm构建(捆绑和缩小)我的angularjs项目。我需要使用“babel-plugin-angularjs-annotate”插件作为我的控制器,使用这种依赖方式:

'use strict' 
import angular from 'angular'

angular.module('TestDI',[]) .controller("MyController", function($scope){
    $scope.name = 'AngularJS'; })

所以我希望在构建之后我的控制器代码如下所示:

'use strict';

import angular from 'angular';

angular.module('TestDI', []).controller("MyController", ['$scope', function ($scope) {
    $scope.name = 'Nazim';
}]);

但Jspm在构建我的应用程序时遇到错误,说:

  

λjspmbundle-sfx index.js bundle.js --minify        为index.js构建单文件sfx包...

     

错误的index.js翻译错误   文件:/// C:/Users/nazim/Desktop/AngularJsTestDI/index.js           ReferenceError:未知插件“babel-plugin-angularjs-annotate”            在PluginManager.subnormaliseString(file:/// C:/Users/nazim/Desktop/AngularJsTestDI/jspm_packages/npm/babel-core@5.8.38/browser.js:9817:13)            在PluginManager.add(file:/// C:/Users/nazim/Desktop/AngularJsTestDI/jspm_packages/npm/babel-core@5.8.38/browser.js:9860:40)            在File.buildTransformers(file:/// C:/Users/nazim/Desktop/AngularJsTestDI/jspm_packages/npm/babel-core@5.8.38/browser.js:8283:21)            在新文件(文件:/// C:/Users/nazim/Desktop/AngularJsTestDI/jspm_packages/npm/babel-core@5.8.38/browser.js:8185:10)            在Pipeline.transform(file:/// C:/Users/nazim/Desktop/AngularJsTestDI/jspm_packages/npm/babel-core@5.8.38/browser.js:13515:16)            在SystemJSNodeLoader.babelTranspile(C:\ Users \ nazim \ AppData \ Roaming \ nvm \ v6.10.1 \ node_modules \ jspm \ node_modules \ systemjs \ dist \ system.src.js:1164:18)            在C:\ Users \ nazim \ AppData \ Roaming \ nvm \ v6.10.1 \ node_modules \ jspm \ node_modules \ systemjs \ dist \ system.src.js:1122:61

0 个答案:

没有答案