[Vuejs]-Using Ag-Grid with Vue2 and Nuxt2

0👍

This was a recent issue reported on the ag-grid github using their react library, but the issue (and solution) appears to be the same for Vue. To fix:

  1. Make sure you’re on ag-grid-vue and ag-grid-community v30.0.2 (according to your package.json you already are)
  2. Include this code in your vue.config.js file
const { defineConfig } = require('@vue/cli-service');
var path = require('path');

module.exports = defineConfig({
  configureWebpack: {
    resolve: {
      alias: {
        'ag-grid-community/styles': path.resolve(
          __dirname,
          'node_modules/ag-grid-community/styles'
        ),
        'ag-grid-community': path.resolve(
          __dirname,
          'node_modules/ag-grid-community/dist/ag-grid-community.cjs.js'
        ),
      },
    },
  },
});

working Stackblitz example

Leave a comment