Does it possible to use ag-grid-comunity and ag-grid-enterprise from cdn with the ag-grid-react version 25 webpack version 4?

Viewed 3

I am trying to reduce primary bundle size by using ag-grid-community and ag-grid-enterprise from CDN

I've added the following lines to the HTML

    <script crossorigin src="https://unpkg.com/ag-grid-community@25.3.0/dist/ag-grid-community.min.noStyle.js"></script>
    <script crossorigin src="https://unpkg.com/ag-grid-enterprise@25.3.0/dist/ag-grid-enterprise.min.noStyle.js"></script>

and the following lines to the webpack

  externals: {
    'react': 'React',
    'react-dom': 'ReactDOM',
    'react-router-dom': 'ReactRouterDOM',
    'ag-grid-enterprise': 'ag-grid-enterprise',
    'ag-grid-community': 'ag-grid-community'
  }

Now I am getting the following error

Uncaught TypeError: can't access property "ColDefUtil", AgGrid is undefined
    js agGridColumn.js:58
    Webpack 32

the root cause of this error - the following line in ag-grid-react

var AgGrid = require("ag-grid-community");
0 Answers
Related