systemjs-builder无法工作

时间:2016-01-12 02:00:08

标签: gulp

使用systemjs-builder构建我的应用时出现问题 这是我的应用程序的结构。

enter image description here

这是构建的功能:

var systemjsBuild = {
        map: {
            'angular2': '../node_modules/angular2',
            'rxjs': '../node_modules/rxjs'
        },
        packages: {
          dist: {
            format: 'register',
            defaultExtension: 'js'
          }
        }
    };


function buildSJS () {
   var builder = new Builder('dist');
   builder.config(systemjsBuild);
   builder.loader.defaultJSExtensions = true;
   builder
          .bundle('main', 'build/main.js', 
            {
                 minify: true,
                 globalDefs: { DEBUG: false }
            })
            .then(function () {
                 console.log('Build complete');
                 done();
             })
             .catch(function (ex) {
                 console.log('error', ex);
                 done('Build failed.');
             });
   }  

但它不起作用,

  

错误[错误:无法计算要捆绑的规范名称   文件:/// E:/myapp/node_modules/angular2/core.js

如果我serve-dev root dist angular2/core.js,则<body> <script src="assets/bundle.js"></script> <script> System.config({ packages: { app: { format: 'register', defaultExtension: 'js' } }, map: { 'angular2': '../node_modules/angular2' } }); System.import('main.js') .then(null, console.error.bind(console)); </script> </body> 加载内容是index.html文件的内容。
的index.html

public class SplashScreen extends SherlockFragmentActivity {
    // Splash screen timer
    private static int SPLASH_TIME_OUT = 2000;
    private PictureFragment mainFragment;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // Add the fragment on initial activity setup
        if (savedInstanceState == null) {
            // Add the fragment on initial activity setup
            mainFragment = new PictureFragment();
            getSupportFragmentManager()
                    .beginTransaction()
                    .add(android.R.id.content, mainFragment)
                    .commit();
        } else {
            // Or set the fragment from restored state info
            mainFragment = (PictureFragment) getSupportFragmentManager()
                    .findFragmentById(android.R.id.content);
        }

           }
}

请帮助我,谢谢

1 个答案:

答案 0 :(得分:1)

我认为您应该将baseURL设置为模块路径下方,以便将baseURL设置为包含其中的build文件夹的文件夹。