我Angular 2编码的应用程序typescript 2使用Intl.js polyfill。
我已经module:"es2015"按照Angular 的建议tsconfig.json允许使用 Rollup.js 进行树摇动。在我的组件中,我只是做import 'intl'
当我在浏览器中运行应用程序时,出现错误
全局未定义
我尝试使用rollup-plugin-commonjs将库转换为es2015
rollup.config.js
plugins: [
nodeResolve({jsnext: true, module: true}),
commonjs({
include: 'node_modules/intl/**/*',
})
]
当我在浏览器中运行应用程序时,我收到错误:
IntlPolyfill 未定义
在线的:
IntlPolyfill.__addLocaleData({locale:"en-US",...});
我注意到这里的库是用它编写的,es6所以它应该与rollup. 关于如何将此库用作es6模块的任何提示?