Skip to content

unidici doesn't play nice with webpack #2015

Description

@uriva

I am writing a package in deno, and compiling it into npm.

Somehow unidici gets in the compiled target.

I then use webpack because I want to use this package in react setup.

webpack refuses to process unidici because of two dependencies: util/types and stream/web

I haven't found a polyfill for them.

Any idea what can be done?

this is my webpack config

const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");

const path = require("path");

module.exports = {
  mode: "production",
  entry: "./src/index.js",
  output: {
    filename: "main.js",
    path: path.resolve(__dirname, "dist"),
  },
  plugins: [new NodePolyfillPlugin()],
  resolve: {
    fallback: {
      perf_hooks: false,
      async_hooks: false,
      dns: false,
      tls: false,
      child_process: false,
      fs: false,
      net: require.resolve("net-websocket-polyfill"),
      diagnostics_channel: require.resolve("diagnostics_channel"),
      worker_threads: require.resolve("bthreads"),
    },
  },
};

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions