Giter Club home page Giter Club logo

Comments (5)

brian-weasner avatar brian-weasner commented on July 1, 2024 3

Any progress on this? This is happening for me with my dependencies.

I did some debugging, and it looks like the following is causing me issues.

My webpack stats do not have modules within each of the chunks. Instead each of my modules have chunks within them.
See copied log of stats param from getExternalModules function:

  {
    "errors": [],
    "warnings": [],
    "hash": "",
    "builtAt": 1626391702947,
    "publicPath": "",
    "outputPath": "",
    "entrypoints": {},
    "namedChunkGroups": {},
    "chunks": [
      {
        "id": "src/app/common/core/jwt-authorizer",
        "rendered": true,
        "initial": true,
        "entry": true,
        "size": 7825,
        "names": [
          "src/app/common/core/jwt-authorizer"
        ],
        "files": [
          "src/app/common/core/jwt-authorizer.js"
        ],
        "hash": "cf21867fdbf405864441",
        "siblings": [],
        "parents": [],
        "children": [],
        "childrenByOrder": {}
      },
      ...
    ],
    "modules": [
      {
        "id": "aws-sdk",
        "identifier": "external \"aws-sdk\"",
        "name": "external \"aws-sdk\"",
        "index": 7,
        "index2": 5,
        "size": 42,
        "built": true,
        "optional": false,
        "prefetched": false,
        "chunks": [
          "src/app/controllers/location"
        ],
        "issuer": "",
        "issuerId": "",
        "issuerName": "",
        "issuerPath": [
          {
            "id": "",
            "identifier": "",
            "name": "",
            "profile": {
              "factory": 17,
              "building": 323
            }
          },
          {
            "id": "",
            "identifier": "",
            "name": "",
            "profile": {
              "factory": 56,
              "building": 279,
              "dependencies": 277
            }
          }
        ],
        "profile": {
          "factory": 1,
          "building": 0
        },
        "failed": false,
        "errors": 0,
        "warnings": 0,
        "assets": [],
        "providedExports": null,
        "optimizationBailout": [],
        "depth": 2
      },
      {
        "id": "crypto",
        "identifier": "external \"crypto\"",
        "name": "external \"crypto\"",
        "index": 4,
        "index2": 2,
        "size": 42,
        "built": true,
        "optional": false,
        "prefetched": false,
        "chunks": [
          "src/app/common/core/jwt-authorizer",
          "src/app/controllers/location"
        ],
        "issuer": "",
        "issuerId": "",
        "issuerName": "",
        "issuerPath": [
          {
            "id": "",
            "identifier": "",
            "name": "",
            "profile": {
              "factory": 73,
              "building": 321,
              "dependencies": 7
            }
          },
          {
            "id": "",
            "identifier": "",
            "name": "",
            "profile": {
              "factory": 9,
              "building": 397
            }
          }
        ],
        "profile": {
          "factory": 0,
          "building": 0
        },
        "failed": false,
        "errors": 0,
        "warnings": 0,
        "assets": [],
        "providedExports": null,
        "optimizationBailout": [],
        "depth": 2
      },
      ...
    ],
    "filteredModules": 0,
    "logging": {
      "webpack.buildChunkGraph.visitModules": {
        "entries": [],
        "filteredEntries": 2,
        "debug": false
      }
    }
  }

Changing getExternalModules(stats: any) to

        if (!stats.chunks) {
            return [];
        }
        const externals = new Set();
        for (const module of stats.modules) {
          if (this.isExternalModule(module) && module.chunks) {
            for (const chunkId of module.chunks) {
              if (stats.chunks.find((chunk) => chunk.id === chunkId)) {
                externals.add({
                  origin: module.issuer,
                  external: this.getExternalModuleName(module),
                });
              }
            }
          }
        }
        return Array.from(externals);

seems to properly add the dependencies to the generated package.json, subsequently allowing the builder to install them into the dist folder for deployment.

from nx-plugins.

wickstargazer avatar wickstargazer commented on July 1, 2024

i am investigating into this. Will find some free time this week to debug, thanks for the repo i can reproduce it now

from nx-plugins.

tstackhouse avatar tstackhouse commented on July 1, 2024

I've ran into this in the past (on older versions) and your triage is spot on, though the root cause may be different. My gut feeling is that it's coming from webpack's packaging, beyond that right now I'm not sure, I'll defer to Wick for now :)

from nx-plugins.

rpaddock avatar rpaddock commented on July 1, 2024

did #89 solve this issue? I'm seeing a valid package.json now, but the dependencies are not making it into the artifacts.

from nx-plugins.

brian-weasner avatar brian-weasner commented on July 1, 2024

It worked for me.
Note: I also have "externalDependencies": "all" set in my angular.json file (Under project-name.architect.build.options) which I believe is the option to install and package the external dependencies.

from nx-plugins.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.