我是第一次使用Rollup(跟随angular.io的例子),我收到了这个错误:
'node_modules/angular2-jwt/angular2-jwt.js'不输出'AuthHttp'
从app.module.js中的这一行:
13:从'angular2-jwt/angular2-jwt'导入{AuthHttp,AuthConfig};
文档说您可以通过在rollup-config.js文件中指定自定义命名导出来纠正此问题,如下所示:
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' ]
}
})
Run Code Online (Sandbox Code Playgroud)
这是我的rollup-config.js文件的相关部分:
plugins: [
nodeResolve({jsnext: true, module: true}),
commonjs({
include: 'node_modules/rxjs/**',
namedExports: {
'node_modules/angular2-jwt/angular2-jwt.js': [ 'AuthHttp' ]
}
}),
Run Code Online (Sandbox Code Playgroud)
但是,这没有任何影响,错误仍然存在.有关如何纠正此问题的任何建议?