question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

__webpack_require__.d is not a function

See original GitHub issue

Bug report

What is the current behavior?

I have a big/medium sized project using webpack 5.36.2. just migrated from webpack 4.44.2. which worked fine for my team but the speed improvement between those two versions is just insane. Thank you for that. I noticed that optimization.runtimeChunk = true gave an extra performance boost, but the resulting bundle shows an error “webpack_require.d is not a function” which seams to happen just in that project. i tried to isolate the error in a small test repo. if i set optimization.runtimeChunk = false then the error disappears, but the build time is significantly higher. sometimes its “webpack_require.r is not a function”.

If the current behavior is a bug, please provide the steps to reproduce.

  1. clone this repo https://github.com/code1x1/webpack-require-d-is-not-a-function
  2. run npm run start
  3. open http://localhost:3000 in your browser
  4. open developer console in your browser

What is the expected behavior?

optimization.runtimeChunk = true should build the bundle and the runtime.~chunk.js should contain webpack_require.d definition which is missing.

Other relevant information: webpack version: 5.36.2 Node.js version: v12.16.3 Operating System: Debian GNU/Linux 10 (buster) Additional tools: npm 6.14.12

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
alexander-akaitcommented, May 11, 2021

Change runtimeChunk: 'true' on ``runtimeChunk: ‘single’, also you need webpack-dev-server@4-beta.3` with options:

devServer: {
        open: false,
        hot: false,
        onListening: (server) => {
            console.log('Listening on address:', server.server.address());
        },
        historyApiFallback: true,
        firewall: [
            'localhost',
            'localhost:3000'
        ],
        static: path.resolve(__dirname, '..', './app'),
        host: '0.0.0.0',
        public: 'http://localhost:3000',
        port: 3000
    },

Stable release will be soon, have to respond and it slows down

0reactions
code1x1commented, May 14, 2021

thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: __webpack_require__.i(...) is not a function
This error can arise if you try to import something from an existing npm package (in node_modules ) but the imported thing doesn't...
Read more >
TypeError: __webpack_require__(...) is not a function #9379
webpack-bug $npm i $npm run build $node . TypeError: __webpack_require__(...) is not a function. babel-plugin-source-map-support is a simple ...
Read more >
Solving Uncaught TypeError: n is not a function
This shows a problem with typeof in a newly added vendor JS file. This is the root cause and fixing it involved removing...
Read more >
TypeError: require(...) is not a function in Node.js | bobbyhadz
To solve the "TypeError: require(...) is not a function", make sure to place a semicolon between your require call and an immediately invoked...
Read more >
Module Methods - webpack
callback : A function that webpack will execute once the dependencies are loaded. An implementation of the require function is sent as a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found