You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently any/all Webpack supports will by default fail at build time as Webpack attempts to resolve Node-native libraries regardless that they're guarded for Node-only use. The Node-native libraries are: stream-http, url (used in the Prometheus Exporter that is bundled) and async_hooks that is used in the library itself.
The issue can be worked around by manually installing and setting up polyfills as documented in #40 and/or probably setting resolve.fallback values to false for the afore-mentioned Node-native libraries. However that is somewhat brittle, and will not work with a default create-react-app config.
We should investigate supporting Webpack without extra configuration if we're looking to support client-side Autometrics.
This is the full error that shows:
Module not found: Error: Can't resolve 'http' in '<USR_PATH>/react-repro/node_modules/@opentelemetry/exporter-prometheus/build/src'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "http": require.resolve("stream-http") }'
- install 'stream-http'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "http": false }
ERROR in ./node_modules/@opentelemetry/exporter-prometheus/build/src/PrometheusExporter.js 25:15-30
Module not found: Error: Can't resolve 'http' in '<USR_PATH>/react-repro/node_modules/@opentelemetry/exporter-prometheus/build/src'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "http": require.resolve("stream-http") }'
- install 'stream-http'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "http": false }
ERROR in ./node_modules/@opentelemetry/exporter-prometheus/build/src/PrometheusExporter.js 28:14-28
Module not found: Error: Can't resolve 'url' in '<USR_PATH>/react-repro/node_modules/@opentelemetry/exporter-prometheus/build/src'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "url": require.resolve("url/") }'
- install 'url'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "url": false }
ERROR in ./node_modules/@autometrics/autometrics/dist/index.mjs 53:12-33
Module not found: Error: Can't resolve 'async_hooks' in '<USR_PATH>/react-repro/node_modules/@autometrics/autometrics/dist'
The text was updated successfully, but these errors were encountered:
Currently any/all Webpack supports will by default fail at build time as Webpack attempts to resolve Node-native libraries regardless that they're guarded for Node-only use. The Node-native libraries are:
stream-http
,url
(used in the Prometheus Exporter that is bundled) andasync_hooks
that is used in the library itself.The issue can be worked around by manually installing and setting up polyfills as documented in #40 and/or probably setting
resolve.fallback
values tofalse
for the afore-mentioned Node-native libraries. However that is somewhat brittle, and will not work with a defaultcreate-react-app
config.We should investigate supporting Webpack without extra configuration if we're looking to support client-side Autometrics.
This is the full error that shows:
The text was updated successfully, but these errors were encountered: