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

__webpack_require__(...) is not a function #305

Open
polisen opened this issue Jul 22, 2021 · 0 comments
Open

__webpack_require__(...) is not a function #305

polisen opened this issue Jul 22, 2021 · 0 comments

Comments

@polisen
Copy link

polisen commented Jul 22, 2021

Hey - I'm using customize-cra and react-app-rewired to override the webpack config usually abstracted away in a create-react-app.

I'm importing the random-int package to the worker file - which is the import that fails.

config-overrides.js

const { override, addWebpackModuleRule, babelInclude } = require("customize-cra");
const path = require('path')
module.exports = override(
  addWebpackModuleRule({
    test: /\.worker\.(js|ts)$/i,
    use: [
      {
        loader: "comlink-loader",
        options: {
          singleton: true,
        },
      },
    ],
  })
);

This is the correct syntax - but now it complains about that webpack doesn't have a require function - which is to be expected. Supposedly something wasn't transpiled by babel but I can't figure out where to even begin.

Do you geniuses have any idea?

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