我正在尝试使用Rollup插件在我的应用程序中使用Tree抖动。
当我运行node_modules/.bin/rollup -c rollup-config.js
时,我收到此错误:
[!] Error: 'Subject' is not exported by node_modules/rxjs/Subject.js
这是我的rollup-config.js
文件:
import nodeResolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import uglify from 'rollup-plugin-uglify';
export default {
input: 'src/main.js',
output: {
file: 'src/build.js', // output a single application bundle
format: 'iife',
},
sourceMap: false,
onwarn: function (warning) {
// Skip certain warnings
// should intercept ... but doesn't in some rollup versions
if (warning.code === 'THIS_IS_UNDEFINED') { return; }
// console.warn everything else
console.warn(warning.message);
},
plugins: [
nodeResolve({ jsnext: true, module: true }),
commonjs({
include: 'node_modules/**',
include: 'node_modules/rxjs/**',
include: 'node_modules/ng2-cache-service/**',
include: 'node_modules/ng2-dragula/**'
}),
uglify()
]
};
我曾经为ng2-cache-service
和ng2-dragula
模块犯了类似的错误,但我通过将它们导入commonjs来解决它们
我不能对rxjs/Subject