Why does the error message "AgGridModule is not exported by module ag-grid-ng2/main.js" appear when running npm run rollup?

Currently, I am working on creating the min.js file for my Angular 2 project using Tree shaking. Previously, I did not encounter any errors because I was not utilizing ag-grid. However, after running npm run rollup, an error is now being displayed in the console. I am unsure whether this issue lies with my code or with the library itself. When inspecting the main.js file of ag-grid, it appears to be exporting the AgGridModule which has left me at a standstill.

Here is the error message:

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

Answer №1

export default {
  entry: 'src/main.aot.js',
  dest: 'aot/dist/build.js', // creating 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/**']`//see this`
      }),
      uglify()
  ]
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for extracting values from a JSON object in Angular when dealing with a JSON string

Storing column values as a json string in the DB table and then sending them to the front end as a json object. [ { "jobId":"efe0ace0-8ed9-45ff-9232-974cbdc89b86", "jobType":"TestExecutionJob", "nextRun":"N/A", "lastRun":"20 ...

The mat-calendar fails to include the specified class when using dateClass functionality

Here are the components of my Calendar: <div class="calendarWrapper mat-elevation-z1"> <mat-calendar [dateClass]="dateClass"></mat-calendar> </div> This is the scss for the custom class to be added: butt ...

ngResource is mistakenly handling POST requests as if they were GET requests

It has come to my attention that despite specifying "POST" in my ngResource factory, the parameters are actually being passed as GET. Here's an example of a user factory: myApp.factory('facUser',['$resource', function ($resource) ...

Creating an application for inputting data by utilizing angular material and javascript

I am looking to create an application using Angular Material Design, AngularJS (in HTML), and JavaScript. The application should take input such as name, place, phone number, and email, and once submitted, it should be stored in a table below. You can fin ...

Changing the URI for the Apollo client instance

Currently, we are using Angular Apollo in one of our projects. The apollo client is being created like this: this.apollo.create({ link: this.httpLink.create({ uri: `${environment.apiBase}/graphql?access_token=${this.tokenService.token}`}), cache: new ...

Issue with Angular 4: Mega menu does not automatically close when a menu item is selected from within it

I am currently working on an Angular 4 project that includes a mega menu. My issue is that when I click on a menu within the mega menu, I want it to close. However, in my current setup, the menu always remains open even after clicking on a specific option. ...

Should we rethink using nested *ngFor loops in Angular 7?

Currently, I am dealing with an object that consists of an array. This array has the capability to contain one or multiple objects similar to the parent object. The levels of nesting in this structure could potentially be infinite. To showcase all the data ...

extract information from local storage using AngularJS

I'm having trouble getting the filter to work in my AngularJS project with local storage. Even though there are no errors, nothing happens when I type words into the input field. Can someone lend a hand? :) html: <div ng-app="myApp" ng-controller ...

Ways to fix the perpetual cycle in adal-angular4 following authentication redirect

I have been working on an Angular 8 application that utilizes Microsoft Azure Active Directory authentication with adal-angular4. I've successfully set up an ASP.NET Core API linked to a client app on Azure. To configure Active Directory, I referred ...

How to efficiently pass multiple inputs from an HTML form to a controller in AngularJS using a single ng

Currently, I have multiple input text boxes in my HTML and I need to send their values to my controller to add them to an object. The challenge I'm facing is figuring out how to pass more than one value using just one ng-model. In my HTML code, I have ...

What is the process for defining a recursive array data structure?

Looking to implement a TypeScript method that can navigate through nested arrays of strings when given an instance of a type/class/interface. The method, in concept, should resemble: method<T>(instance: T, arrayAttr: someType) { let tmp = undefin ...

Get a collection of images packed into a single zip file

My current function downloads multiple images and saves them to a user's "download" folder, although it only works in Chrome. I am looking to enhance this function by combining the downloaded images into a single zip file. Below is my existing code. ...

Updating ng-init in AngularJS triggered by a changeOR Changing

Is there a way for ng-init to be updated when the tableCells change? I'm looking for a method that will avoid angular from calling findCellsByDate twice. I've also attempted changing ng-init to ng-bind or ng-model, but ng-bind displays [object O ...

Issue with displaying Ng-x spinner in Angular 5 function

Have you ever encountered this issue before? I've noticed that ngx-spinner doesn't work when used within a function, but it works fine when placed inside the subscribed callback. When placed outside of the authservice, the spinner isn't dis ...

What is the purpose of code indentation or adding semicolons in WebStorm?

In my Angular project, I am encountering a semicolon issue with arrow functions while using WebStorm. https://i.sstatic.net/R3Wmy.png By removing the semicolon, I was able to resolve the error. However, whenever I format my file using Command + Option + ...

View setup in progress

I'm interested in implementing something along these lines: app.config(function($routeProvider){ $routeProvider.when('products/list', { controller: 'ProductListCtrl', templateUrl : 'products/list/view.html', ...

Ways to Access HTTP Request Headers in Angular 6 upon Page Load

Is it possible to retrieve request header information in Angular 6/7 upon application initialization? I specifically require access to header values for security and access management purposes, as these values are set in the headers during the usage of th ...

How to choose the placeholder element in Svelte?

I'm currently working on adding a placeholder to a select element, but I'm encountering an issue. When I include the selected attribute for the first option, it displays as an empty space. <select> {#if placeholder} <option v ...

Sharing methods between controllers in AngularJS

After coming across this insightful article on Angular validation, I decided to implement it in my project. The validation is functioning perfectly, but I am struggling to access methods in other controllers upon successful form validation. Despite trying ...

Using AngularJS to modify a record

I am currently developing a web application using C# with angularjs. Within my app, I have multiple records that I need to update. I have set up the necessary web service and included the required JS files for updating these records. My main concern is fig ...