Sourabh Soni

Joined

50 Experience
0 Lessons Completed
0 Questions Solved

Activity

root@ubuntu:~/Make-Rails# ./bin/webpack
[webpack-cli] 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.

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

// Correct way to set custom entry points
// This assumes you have an entry point at './app/javascript/packs/application.js'
// Adjust the path according to your project structure
environment.config.set('entry', {
application: ['./app/javascript/packs/application.js']
});

module.exports = environment;

//config/webpack/production.js
process.env.NODE_ENV = process.env.NODE_ENV || 'production'
const environment = require('./environment')
module.exports = environment.toWebpackConfig()

{
"dependencies": {
"@rails/webpacker": "5.4.4",
"webpack": "5.0.0",
"webpack-cli": "4.0.0",
"bootstrap": "5.1.3"
},
"devDependencies": {
"webpack-dev-server": "4.0.0"
},
"license": "MIT"
}