Custom Named Exports in Rollup Not Working

Viewed 6410

I am using Rollup for the first time (following the example at angular.io) and I'm getting this error:

'AuthHttp' is not exported by 'node_modules/angular2-jwt/angular2-jwt.js'

from this line in app.module.js:

13: import { AuthHttp, AuthConfig } from 'angular2-jwt/angular2-jwt';

The docs say you can correct this by specifying a custom named export in the rollup-config.js file like this:

commonjs({
  namedExports: {
    // left-hand side can be an absolute path, a path
    // relative to the current directory, or the name
    // of a module in node_modules
    'node_modules/my-lib/index.js': [ 'named' ]
  }
})

here is the relevant section of my rollup-config.js file:

  plugins: [
      nodeResolve({jsnext: true, module: true}),
      commonjs({
        include: 'node_modules/rxjs/**',
         namedExports: {
          'node_modules/angular2-jwt/angular2-jwt.js': [ 'AuthHttp' ]
        }
      }),

However this does not have any effect and the error remains. Any suggestions on how to correct this?

1 Answers
Related