捆绑失败:' CloudModule'不会导出

时间:2016-10-20 21:02:00

标签: angular ionic2

我正在尝试向我的Ionic2应用添加推送通知。我跟随this。按照ionic2推送文档页面的建议,我的应用程序在执行ionic io init之前正常工作,现在我每次都会遇到此错误ionic serve

bundle failed: 'CloudModule' is not exported by node_modules/@ionic/cloud-angular/dist/es5/index.js 
            (imported by src/app/app.module.ts). For help fixing this error see https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module 

1 个答案:

答案 0 :(得分:0)

为了使其正常工作,我必须按照here中的建议将其添加到我的文件rollup.config.js

node_modules/@ionic/app-scripts/config/rollup.config.js

module.exports = {

  [...]
  useStrict: false,
   [...]

  plugins: [
    ngTemplate(),
    commonjs({
        include: [
         [...]
        'node_modules/@ionic/cloud-angular/**',
        'node_modules/superagent/**',
        'node_modules/@ionic/cloud/node_modules/superagent/**',
        'node_modeule/emitter/**',
        'node_modules/reduce-component/**',
        'node_modules/intl/**',
        'node_modules/**',
        ],
        namedExports: {
          [...]
        }
    }),
    nodeResolve({
      useStrict: false,
      module: true,
      jsnext: true,
      main: true,
      browser: true,
      extensions: ['.js']
    })
  ]

};

即使这会使构建过程变慢