Join the Stack Overflow Community
Stack Overflow is a community of 6.6 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I m learning angular 2 and redux and I'm having some trouble using Systemjs and immutable.

From now, I m having the following systemjs.conf.js :

/*
 * This config is only used during development and build phase only
 * It will not be available on production
 *
 */

;(function (global) {
  // ENV
  global.ENV = global.ENV || 'development'

  // wildcard paths
  var paths = {
    'n:*': 'node_modules/*'
  }

  // map tells the System loader where to look for things
  var map = {
    'app': 'tmp/app',
    'test': 'tmp/test',
    'rxjs': 'n:rxjs',
    '@angular': 'n:@angular',
    'lodash': 'n:lodash',
    'redux': 'n:redux',
    'immutable': 'n:immutable'
  }

  // packages tells the System loader how to load when no filename and/or no extension
  var packages = {
    'src/tmp/app': {
      defaultExtension: 'js'
    },
    'app': {
      defaultExtension: 'js'
    },
    'test': {
      defaultExtension: 'js'
    },
    'rxjs': {
      defaultExtension: 'js'
    },
    'redux': {
      main: 'dist/redux.min.js'
    },
    'immutable': {
      main: 'dist/immutable.min.js'
    }
  }

  // Add package entries for angular packages
  var ngPackageNames = [
    'common',
    'compiler',
    'core',
    'http',
    'platform-browser',
    'platform-browser-dynamic',
    'router'
  ]

  // add package entries for packages that expose barrels using index.js
  var packageNames = [
    'lodash'
  ]

  ngPackageNames.forEach(function (pkgName) {
    var main = global.ENV === 'testing' ? 'index.js' :
      pkgName + '.umd.js'

    packages['@angular/' + pkgName] = {
      main: main,
      defaultExtension: 'js'
    }
  })

  packageNames.forEach(function (pkgName) {
    packages[pkgName] = {
      main: 'index.js',
      defaultExtension: 'js'
    }
  })

  var config = {
    map: map,
    packages: packages,
    paths: paths
  }

  // filterSystemConfig - index.html's chance to modify config before we register it.
  if (global.filterSystemConfig) {
    global.filterSystemConfig(config)
  }

  System.config(config)
})(this)

from a starter kit. The import of redux is well resolved and works great.

My problem is when I try to import immutablejs. In fact, when I start my tests, I've got the following error :

src\app\redux\board\board.reducer.ts(2,8): error TS1192: Module '"C:/Project/angular2/kanboard/node_modules/immutable/dist/immutable-nonambient"' has no default export. npm ERR! Test failed. See above for more details.

It seems that immutable-nonambient doesn't provide the expected interface. But I reference the min.js file in my systemjs.conf file.

Does any body have an idea ?

Thanks for your help

share|improve this question
    
Check my question as it contains the answer :) stackoverflow.com/questions/38352736/… – LithStud Jul 19 '16 at 13:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.