Angular: Cannot import packages with @angular-devkit/build-angular:application

52 Views Asked by At

I'm using Angular 17 and have Leaflet and leaflet.gridlayer.googlemutnt package installed. The leaflet package works fine but when I'm importing leaflet.gridlayer.googlemutant I had this error: [vite] Internal server error: Failed to resolve entry for package "leaflet.gridlayer.googlemutant". The package may have incorrect main/module/exports specified in its package.json.

It's only works when I configured the angular.json to

"build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/fe-avema",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": [
              "zone.js"
            ],
...

But I want to use the application builder like this for high performance:

"build": {
          "builder": "@angular-devkit/build-angular:application",
          "options": {
            "outputPath": "dist/fe-avema",
            "index": "src/index.html",
            "browser": "src/main.ts",
            "polyfills": [
              "zone.js"
            ],
...
0

There are 0 best solutions below