Option 1: JSON dump
In config/webpack/environment.js
you can get inspect environment
which includes all webpack config options set for the current environment:
const { environment } = require('@rails/webpacker')
const webpack = require('webpack')
throw JSON.stringify(environment, null, 2)
...
Option 2: Browser console
You can also debug the config in your browser directly with a newer version of Webpacker:
process.env.NODE_ENV = process.env.NODE_ENV || 'development'
const environment = require('./environment')
const webpackConfig = environment.toWebpackConfig()
debugger
module.exports = webpackConfig
- Run
bin/webpack --debug-webpacker
(see here Show archive.org snapshot ) - Go to
chrome://inspect
- Follow "inspect" in the "Remote Target" section
- A new browser will open with a breakpoint at "process.exitCode = 0;" and you can press "Resume script execution" to jump to the your set breakpoint
Option 3: Node console
$ RAILS_ENV=development node
const config = require('./config/webpack/development')
Option 4: Printing warnings
const process = require('process')
const { environment } = require('@rails/webpacker')
const webpack = require('webpack')
process.emitWarning('Some warning')
Posted by Natalie Zeumann to makandra dev (2018-07-09 13:57)