Skip to content

ng build with node package not polyfill #27425

Closed
@wszgrcy

Description

@wszgrcy

Command

build

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

I did not encounter any errors regarding node references during development, but the following errors occurred during build

Minimal Reproduction

  1. ng new demo
  2. import @react-pdf/renderer
  3. build

default angular.json

Exception or Error

X [ERROR] Could not resolve "fs"

    node_modules/@react-pdf/image/lib/index.js:3:15:
      3 │ import fs from 'fs';
        ╵                ~~~~

  The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.    


X [ERROR] Could not resolve "url"

    node_modules/@react-pdf/image/lib/index.js:4:16:
      4 │ import url from 'url';
        ╵                 ~~~~~

  The package "url" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.   


X [ERROR] Could not resolve "path"

    node_modules/@react-pdf/image/lib/index.js:5:17:
      5 │ import path from 'path';
        ╵                  ~~~~~~

  The package "path" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.  


X [ERROR] Could not resolve "stream"

    node_modules/@react-pdf/pdfkit/lib/pdfkit.js:2:19:
      2 │ import stream from 'stream';
        ╵                    ~~~~~~~~

  The package "stream" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

X [ERROR] Could not resolve "zlib"

    node_modules/@react-pdf/pdfkit/lib/pdfkit.js:4:17:
      4 │ import zlib from 'zlib';
        ╵                  ~~~~~~

  The package "zlib" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.  


X [ERROR] Could not resolve "fs"

    node_modules/@react-pdf/pdfkit/lib/pdfkit.js:9:15:
      9 │ import fs from 'fs';
        ╵                ~~~~

  The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.    


X [ERROR] Could not resolve "fs"

    node_modules/@react-pdf/png-js/lib/png-js.js:1:15:
      1 │ import fs from 'fs';
        ╵                ~~~~

  The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.    


X [ERROR] Could not resolve "zlib"

    node_modules/@react-pdf/png-js/lib/png-js.js:2:17:
      2 │ import zlib from 'zlib';
        ╵                  ~~~~~~

  The package "zlib" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.  


X [ERROR] Could not resolve "fs"

    node_modules/@react-pdf/renderer/lib/react-pdf.js:6:15:
      6 │ import fs from 'fs';
        ╵                ~~~~

  The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

Your Environment

_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 17.3.3
Node: 20.10.0
Package Manager: npm 10.2.3
OS: win32 x64

Angular: 17.3.3
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1703.3
@angular-devkit/build-angular   17.3.3
@angular-devkit/core            17.3.3
@angular-devkit/schematics      17.3.3
@schematics/angular             17.3.3
ng-packagr                      17.3.0
rxjs                            7.8.1
typescript                      5.4.3
zone.js                         0.14.4

Anything else relevant?

No response

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions