Webpack 5: configuration.node has an unknown property 'dgram'. These properties are valid:

See original GitHub issue

I receive an error message:

Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
 - configuration.node should be one of these:
   false | object { __dirname?, __filename?, global? }
   -> Include polyfills or mocks for various node stuff.
   Details:
    * configuration.node has an unknown property 'dgram'. These properties are valid:
      object { __dirname?, __filename?, global? }
      -> Options object for node compatibility features.
    * configuration.node has an unknown property 'fs'. These properties are valid:
      object { __dirname?, __filename?, global? }
      -> Options object for node compatibility features.
    * configuration.node has an unknown property 'net'. These properties are valid:
      object { __dirname?, __filename?, global? }
      -> Options object for node compatibility features.
    * configuration.node has an unknown property 'tls'. These properties are valid:
      object { __dirname?, __filename?, global? }
      -> Options object for node compatibility features.
    * configuration.node has an unknown property 'child_process'. These properties are valid:
      object { __dirname?, __filename?, global? }
      -> Options object for node compatibility features.

because of this setting:

node: {
    dgram: 'empty',
    fs: 'empty',
    net: 'empty',
    tls: 'empty',
    child_process: 'empty',
  },

What is the equavilent in Webpack 5?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:15
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

34reactions
alesrosinacommented, Feb 26, 2021

@slava-vishnyakov do you know how you would implement this solution for a rails webpacker.yml solution?

Inside config/webpack/*.js you should have some configs for your env (as described here: https://github.com/rails/webpacker#webpack-configuration). You need to remove those, so for example, i have in base.js:

const { environment } = require('@rails/webpacker')

const customConfig = {
  resolve: {
    fallback: {
      dgram: false,
      fs: false,
      net: false,
      tls: false,
      child_process: false
    }
  }
};

environment.config.delete('node.dgram')
environment.config.delete('node.fs')
environment.config.delete('node.net')
environment.config.delete('node.tls')
environment.config.delete('node.child_process')

environment.config.merge(customConfig);

module.exports = environment

it solved this issue for me

27reactions
Shigawirecommented, Feb 16, 2021

To anyone who also has the same problem: We’re using rails webpacker and had the described issue. Rails’ webpacker 5.x.x is only compatible with webpack 4.x.x (https://github.com/rails/webpacker/tree/5-x-stable). You might want to downgrade to webpack 4 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack Error - configuration.node has an unknown property 'fs'
I managed to get this to work with some help from the Webpack team. Using the following webpack configuration as recommended by the...
Read more >
Node - webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >
Getting Webpack invalidation error when trying to start dev ...
Options object for node compatibility features. * configuration.node has an unknown property 'dgram'. These properties are valid:.
Read more >
options has an unknown property 'inline'. these ... - You.com
Details: * configuration.node has an unknown property 'dgram'. These properties are valid: object { __dirname?, __filename?
Read more >
Ruby on Jets Webpacker errors and Invalid Configuration Object
node has an unknown property 'dgram'. These properties are valid: object { __dirname?, __filename?, global? } -> Options object for node ...
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