-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
angular-lib build path doesn't work with mqtt as dependency #156
Comments
nodejs/readable-stream#435 |
good part is that in webpack 5 node shims will be removed from webpack, and all libs will have to avoid using them, but till then we need some fix. To be clear I have one super hack solution now. But it's pretty ugly. |
npm after install script: const fs = require('fs');
const f = 'node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/browser.js';
fs.readFile(f, 'utf8', function (err,data) {
if (err) {
return console.log(err);
}
// at some moment angular-cli tam disabled node polyfills and stubs in webpack
// from:
// node: false
// to:
// node: {global: true}
const result = (data.replace(/node: false/g, "node: {global: true}"));
fs.writeFile(f, result, 'utf8', function (err) {
if (err) return console.log(err);
});
}); this will hepl, but it's a super dirty solution, should be avoided in any lib (but it works) |
Is this hack enough to run |
yes. This hack will fix it. |
I'm using 7.0.9 version in angular project.
|
ok, my hack will do almost the same, but using webpack shim (will broke on webpack 5, where shims will be removed). Webpack 5 in roadmap of Angular development. Currently hack will work, please make PR with it and reference it here. |
@sclausen could you please review\merge that PR? It will fix broken builds. |
@nosovk Unfortunately, the published package is broken, since mqtt can't be embedded without browserification.
Do you have a solution for this issue, or know how to embed the old vendor mqtt.js?
That's the error I get when using the library in 7.0.9.
The text was updated successfully, but these errors were encountered: