将RequireJs改为AlmondsJs

时间:2014-01-20 14:00:20

标签: ember.js requirejs handlebars.js amd almond

我有一个EmberJs应用程序和requireJs,在优化之后我想用AlmondJs替换requirejs库但是我总是得到这个错误

  

找不到模块把手。

有人知道它可能是什么吗?

这是我的构建文件

({
appDir: "../",
baseUrl: ".",
dir: '../../www',
modules: [
    {
        name: "app/main"
    }
],
inlineText: false,
//removeCombined: true,
preserveLicenseComments: false,
insertRequire: ['app/main'],
wrap:true,
paths: {
    jquery: 'js/libs/jquery-1.9.1',
    jquerycookies: 'js/libs/jquery.cookie',
    //jqueryhotkeys: 'js/libs/jquery.hotkeys',
    //  jquerytouchSwipe: 'js/libs/jquery.touchSwipe.min',
    //  jqueryui: 'js/libs/jquery-ui.custom.min',
    // jqueryUiWidget: 'js/libs/jquery.ui.widget',
    //jqueryDropzone: 'js/libs/jquery.fileupload',
    jqueryJcrop: 'js/libs/jquery.Jcrop.min',
    highcharts: 'js/libs/highcharts',
    fastClick: 'js/libs/ember-fastclick',
    emberAnalytics: 'js/libs/ember-analytics',
    // fullCalendar: 'js/libs/fullcalendar.min',
    responsiveTables: 'js/libs/responsive-tables',
    lazyload: 'js/libs/jquery.lazyload.min',
    handlebars: 'js/libs/handlebars',
    ember: 'js/libs/ember',
    //  ember_data: 'js/libs/ember-data.min',
    ember_animate: 'js/libs/ember-animated-outlet',
    // ember_I18n: 'js/libs/i18n',
    foundation: 'js/foundation/foundation',
    foundationReveal: 'js/foundation/foundation.reveal',
    foundationDropdown: 'js/foundation/foundation.dropdown',
    foundationForms: 'js/foundation/foundation.forms',
    foundationJoyride: 'js/libs/intro',
    //    ckeditorcore: 'js/ckeditor/ckeditor',
    //  ckeditorjquery: 'js/ckeditor/adapters/jquery',
    datePicker: 'js/plugins/jquery.simple-dtpicker'
},
shim: {
    'ember': {
        deps: ['jquery','handlebars'],
        exports: 'Ember'
    },
    'fastClick': {
        deps: ['ember'],
        exports: 'fastClick'
    },
    'emberAnalytics': {
        deps: ['ember'],
        exports: 'emberAnalytics'
    },
    'ember_animate': {
        deps: ['ember'],
        exports: 'Animate'
    },
    'jqueryJcrop': {
        deps: ['jquery']
    },
    'jquerycookies': {
        deps: ['jquery'],
        exports: 'jQueryCookies'
    },
    'jqueryDropzone': {
        deps: ['jquery'],
        exports: 'jqueryDropzone'
    },
    'foundationJoyride': {
        exports: 'foundationJoyride'
    },
    'datePicker': {
        deps: ['jquery'],
        exports: 'datePicker'
    },
    'highcharts': {
        deps: ['jquery'],
        exports: 'highcharts'
    },
    'responsiveTables': {
        deps: ['jquery'],
        exports: 'responsiveTables'
    },
    'lazyload': {
        deps: ['jquery'],
        exports: 'lazyload'
    },
    'foundation': {
        deps: ['jquery'],
        exports: 'foundation'
    },
    'foundationReveal': {
        deps: ['jquery', 'foundation'],
        exports: 'foundation'
    },
    'foundationDropdown': {
        deps: ['jquery', 'foundation', 'foundationForms'],
        exports: 'foundation'
    },
    'foundationForms': {
        deps: ['jquery', 'foundation'],
        exports: 'foundation'
    }
},
waitSeconds: 60
})

2 个答案:

答案 0 :(得分:0)

将构建文件更改为

baseUrl: '../',
name: 'js/libs/almond',
include: ['app/main'],
insertRequire: ['app/main'],
out: '../../www/app/main.js',
//wrap: true,

并删除wrap:true选项它可能正常工作

由于

答案 1 :(得分:0)

我在Handlebars 1.3.0中遇到了同样的问题。我使用mimosa.io作为我的构建系统。

用,

包装所有handlebars.js
(function(){

  // Insert existing hb.js code here //

  this.Handlebars = Handlebars;
}).call(this);

修好了!

感谢hint - @ c4p