我正在尝试让 ag-grid 与 webpack 一起使用。我通过 npm 添加 ag-grid 并通过执行以下操作添加对 webpack.config 的引用来完成标准操作:
resolve: {
alias: {"ag-grid" : path.resolve(__dirname, "./node_modules/ag-grid/dist/ag-grid.js")
}
该文件被解析并加载到索引文件中就好了。我已经为角度做了以下工作。
angular.module("cs-app", [require("ag-grid").name]);
Webpack 也解析了这个文件并被包含和加载,但是当我运行应用程序时,我得到了以下错误。
[$injector:modulerr] Failed to instantiate module angularGridGlobalFunction due to:
[$injector:nomod] Module 'angularGridGlobalFunction' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
我在 ag-grid.js 中找不到名称 angularGridGlobalFunction,但是当我注释掉对 ag-grid 的引用时,应用程序就可以正常工作。
所以有人建议吗?