我正在尝试使用 Tree shaking 为我的 angular2 项目创建 min.js 文件。所以,早些时候我没有为此使用 ag-grid,所以当时没有错误,但现在当我运行 npm run rollup 时,它在控制台抛出了这个错误。我不确定这是我的错还是图书馆的错。 当我打开 ag-grid 的 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! yourmanager@1.0.0 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 yourmanager@1.0.0 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
最佳答案
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()
]
}
关于angularjs - npm run rollup 显示错误消息 "Module ag-grid-ng2/main.js does not export AgGridModule"。?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39700484/