Skip to content

removing node-shims in v6.0.0 breaks ngx-mqtt #10410

@sclausen

Description

@sclausen

I understand the motivation of removing node-shims, but it breaks my library and I currently don't know how to work around this.

Versions

Angular CLI: 6.0.0-rc.5
Node: 8.11.1
OS: linux x64
Angular: 6.0.0-rc.3
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.5.4
@angular-devkit/build-angular      0.5.4
@angular-devkit/build-ng-packagr   0.5.4
@angular-devkit/build-optimizer    0.5.4
@angular-devkit/core               0.5.4
@angular-devkit/schematics         0.5.7
@angular/cli                       6.0.0-rc.5
@ngtools/json-schema               1.1.0
@ngtools/webpack                   6.0.0-rc.2.4
@schematics/angular                0.5.7
@schematics/update                 0.5.7
rxjs                               6.0.0-tactical-rc.1
typescript                         2.7.2
webpack                            4.5.0

Repro steps

Running an application with a ngx-mqtt@6.0.0-alpha.8 build of my library results in an error that process is not defined.

Observed behavior

index.js:3 Uncaught ReferenceError: process is not defined
    at Object../node_modules/process-nextick-args/index.js (index.js:3)
    at __webpack_require__ (bootstrap:74)
    at Object../node_modules/readable-stream/lib/_stream_readable.js (_stream_readable.js:26)
    at __webpack_require__ (bootstrap:74)
    at Object../node_modules/readable-stream/readable-browser.js (readable-browser.js:1)
    at __webpack_require__ (bootstrap:74)
    at Object../node_modules/mqtt/lib/store.js (store.js:8)
    at __webpack_require__ (bootstrap:74)
    at Object../node_modules/mqtt/lib/client.js (client.js:7)
    at __webpack_require__ (bootstrap:74)
./node_modules/process-nextick-args/index.js @ index.js:3
__webpack_require__ @ bootstrap:74
./node_modules/readable-stream/lib/_stream_readable.js @ _stream_readable.js:26
__webpack_require__ @ bootstrap:74
./node_modules/readable-stream/readable-browser.js @ readable-browser.js:1
__webpack_require__ @ bootstrap:74
./node_modules/mqtt/lib/store.js @ store.js:8
__webpack_require__ @ bootstrap:74
./node_modules/mqtt/lib/client.js @ client.js:7
__webpack_require__ @ bootstrap:74
./node_modules/mqtt/lib/connect/index.js @ index.js:3
__webpack_require__ @ bootstrap:74
./node_modules/ngx-mqtt/esm5/ngx-mqtt.js @ validations.js:52
__webpack_require__ @ bootstrap:74
./src/app/app.component.ts @ main.js:72
__webpack_require__ @ bootstrap:74
./src/app/app.module.ts @ app.component.ts:15
__webpack_require__ @ bootstrap:74
./src/main.ts @ environment.ts:16
__webpack_require__ @ bootstrap:74
0 @ main.ts:12
__webpack_require__ @ bootstrap:74
checkDeferredModules @ bootstrap:43
webpackJsonpCallback @ bootstrap:30
(anonymous) @ main.js:1

Desired behavior

I would like to either optionally add node-shims or maybe a possibility to add browserified code to the bundle. I added mqtt directly to my library dependencies and since mqtt provides a browserified bundle, this would be an option too. But ng-packagr currently has no option to directly embedd javascript files into the bundle.

Mention any other details that might be useful (optional)

ngx-mqtt has a branch 6.0.0-alpha with the library code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions