Skip to content
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

Circular dependencies for external libraries #25

Open
lukesmolo opened this issue Nov 12, 2021 · 1 comment
Open

Circular dependencies for external libraries #25

lukesmolo opened this issue Nov 12, 2021 · 1 comment

Comments

@lukesmolo
Copy link
Member

When using external libraries, wam compilation phase complains with several warnings about circular dependencies even if the compilation ends and the bundle is created. Nevertheless, the bundle does not contain all the dependencies needed by the external library and so the application crashes.
It seems that the problem occurs when importing a (nodejs) library in this way:

import * as mqtt from 'mqtt';

while instead there are no problems if importing the library in this way:

var mqtt = require('mqtt')
@lukesmolo
Copy link
Member Author

For instance for mqtt library:

'events' is imported by node_modules/mqtt/lib/client.js, but could not be resolved – treating it as an external dependency
'events' is imported by events?commonjs-external, but could not be resolved – treating it as an external dependency
'url' is imported by node_modules/mqtt/lib/connect/index.js, but could not be resolved – treating it as an external dependency
'url' is imported by url?commonjs-external, but could not be resolved – treating it as an external dependency
'stream' is imported by node_modules/mqtt/node_modules/readable-stream/readable.js, but could not be resolved – treating it as an external dependency
'stream' is imported by stream?commonjs-external, but could not be resolved – treating it as an external dependency
'net' is imported by node_modules/mqtt/lib/connect/tcp.js, but could not be resolved – treating it as an external dependency
'url' is imported by node_modules/mqtt/lib/connect/ws.js, but could not be resolved – treating it as an external dependency
'tls' is imported by node_modules/mqtt/lib/connect/tls.js, but could not be resolved – treating it as an external dependency
'net' is imported by net?commonjs-external, but could not be resolved – treating it as an external dependency
'tls' is imported by tls?commonjs-external, but could not be resolved – treating it as an external dependency
'util' is imported by node_modules/inherits/inherits.js, but could not be resolved – treating it as an external dependency
'util' is imported by util?commonjs-external, but could not be resolved – treating it as an external dependency
'events' is imported by node_modules/mqtt/node_modules/readable-stream/lib/_stream_readable.js, but could not be resolved – treating it as an external dependency
'util' is imported by node_modules/mqtt/node_modules/readable-stream/lib/_stream_readable.js, but could not be resolved – treating it as an external dependency
'events' is imported by node_modules/mqtt-packet/parser.js, but could not be resolved – treating it as an external dependency
'events' is imported by node_modules/mqtt-packet/generate.js, but could not be resolved – treating it as an external dependency
'tty' is imported by node_modules/debug/src/node.js, but could not be resolved – treating it as an external dependency
'util' is imported by node_modules/debug/src/node.js, but could not be resolved – treating it as an external dependency
'tty' is imported by tty?commonjs-external, but could not be resolved – treating it as an external dependency
'stream' is imported by node_modules/mqtt/node_modules/readable-stream/lib/internal/streams/stream.js, but could not be resolved – treating it as an external dependency
'util' is imported by node_modules/mqtt/node_modules/readable-stream/lib/internal/streams/BufferList.js, but could not be resolved – treating it as an external dependency
'os' is imported by node_modules/supports-color/index.js, but could not be resolved – treating it as an external dependency
'util' is imported by node_modules/util-deprecate/node.js, but could not be resolved – treating it as an external dependency
'buffer' is imported by node_modules/safe-buffer/index.js, but could not be resolved – treating it as an external dependency
'os' is imported by os?commonjs-external, but could not be resolved – treating it as an external dependency
'buffer' is imported by node_modules/core-util-is/lib/util.js, but could not be resolved – treating it as an external dependency
'buffer' is imported by buffer?commonjs-external, but could not be resolved – treating it as an external dependency
'stream' is imported by node_modules/duplexify/node_modules/readable-stream/readable.js, but could not be resolved – treating it as an external dependency
'buffer' is imported by node_modules/bl/BufferList.js, but could not be resolved – treating it as an external dependency
'stream' is imported by node_modules/readable-stream/readable.js, but could not be resolved – treating it as an external dependency
'stream' is imported by node_modules/websocket-stream/node_modules/readable-stream/readable.js, but could not be resolved – treating it as an external dependency
'events' is imported by node_modules/duplexify/node_modules/readable-stream/lib/_stream_readable.js, but could not be resolved – treating it as an external dependency
'util' is imported by node_modules/duplexify/node_modules/readable-stream/lib/_stream_readable.js, but could not be resolved – treating it as an external dependency
[...]
[core/servient] Servient caught Servient found error in privileged script 'dist/bundle.js' and halted with VMError: Error loading 'events'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant