2016-09-26 22 views
3

我正在嘗試爲使用樹抖動的我的angular2項目創建min.js文件。所以,早些時候我沒有使用ag-grid,所以當時沒有錯誤,但現在當我運行npm運行彙總它在控制檯拋出這個錯誤。我不確定這是我的錯還是庫故障。 當我打開Ag-grid的main.js文件時,它正在導出AgGridModule,而現在,我卡住了。npm運行彙總顯示錯誤消息「模塊ag-grid-ng2/main.js不導出AgGridModule」。

以下是錯誤消息:

Module /home/knoldus/yourManager/node_modules/ag-grid-ng2/main.js does not export AgGridModule (imported by /home/knoldus/yourManager/dist/temp/client/app/assets/asset.module.js) 
    Error: Module /home/knoldus/yourManager/node_modules/ag-grid-ng2/main.js does not export AgGridModule (imported by /home/knoldus/yourManager/dist/temp/client/app/assets/asset.module.js) 
     at Module.trace (/home/knoldus/yourManager/node_modules/rollup/src/Module.js:683:30) 
     at /home/knoldus/yourManager/node_modules/rollup/src/Module.js:265:30 
     at Array.forEach (native) 
     at /home/knoldus/yourManager/node_modules/rollup/src/Module.js:263:25 
     at Array.forEach (native) 
     at Module.bindReferences (/home/knoldus/yourManager/node_modules/rollup/src/Module.js:256:19) 
     at /home/knoldus/yourManager/node_modules/rollup/src/Bundle.js:104:44 
     at Array.forEach (native) 
     at /home/knoldus/yourManager/node_modules/rollup/src/Bundle.js:104:18 
    Type rollup --help for help, or visit https://github.com/rollup/rollup/wiki 

    npm ERR! Linux 4.4.0-36-generic 
    npm ERR! argv "/usr/local/bin/node" "/home/knoldus/npm/bin/npm" "run" "rollup" 
    npm ERR! node v6.2.2 
    npm ERR! npm v3.10.5 
    npm ERR! code ELIFECYCLE 
    npm ERR! [email protected] rollup: `rollup -f iife -c -o dist/prod/client/app/bundle.es2015.js` 
    npm ERR! Exit status 1 
    npm ERR! 
    npm ERR! Failed at the [email protected] rollup script 'rollup -f iife -c -o dist/prod/client/app/bundle.es2015.js'. 
    npm ERR! Make sure you have the latest version of node.js and npm installed. 
    npm ERR! If you do, this is most likely a problem with the yourmanager package, 
    npm ERR! not with npm itself. 
    npm ERR! Tell the author that this fails on your system: 
    npm ERR!  rollup -f iife -c -o dist/prod/client/app/bundle.es2015.js 
    npm ERR! You can get information on how to open an issue for this project with: 
    npm ERR!  npm bugs yourmanager 
    npm ERR! Or if that isn't available, you can get their info via: 
    npm ERR!  npm owner ls yourmanager 
    npm ERR! There is likely additional logging output above. 

    npm ERR! Please include the following file with any support request: 
    npm ERR!  /home/knoldus/yourManager/npm-debug.log 

回答

1
export default { 
    entry: 'src/main.aot.js', 
    dest: 'aot/dist/build.js', // output a single application bundle 
    sourceMap: false, 
    sourceMapFile: 'aot/dist/build.js.map', 
    format: 'iife', 
    plugins: [ 
     nodeResolve({jsnext: true, module: true}), 
     commonjs({ 
     include: ['node_modules/rxjs/**','node_modules/ng2-dragula/**', 
     'node_modules/ng2-uploader/**','node_modules/dragula/**', 
     'node_modules/ag-grid-ng2/**']`//look this` 
     }), 
     uglify() 
    ] 
} 
+1

請提供你的答案描述性註釋。 –

+0

謝謝,這工作! @Maxim:添加'node_modules/ag-grid-ng2/**'的include是解決此問題的方法。 – blagerweij