用Rollup插件摇动的角4树

时间:2017-08-21 14:35:24

标签: javascript angular angular2-aot tree-shaking

我正在尝试使用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-serviceng2-dragula模块犯了类似的错误,但我通过将它们导入commonjs来解决它们

我不能对rxjs/Subject

做同样的事情

0 个答案:

没有答案