Skip to content

Instantly share code, notes, and snippets.

@kevinhq
Created July 15, 2020 05:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kevinhq/081f2f247db8d7f4301fbcf9b92f699f to your computer and use it in GitHub Desktop.
Save kevinhq/081f2f247db8d7f4301fbcf9b92f699f to your computer and use it in GitHub Desktop.
Step-by-Step guide on how to move from Sprockets to Webpacker - erb.js
// config/webpack/loaders/erb.js
module.exports = {
test: /\.erb$/,
enforce: 'pre',
exclude: /node_modules/,
use: [{
loader: 'rails-erb-loader',
options: {
runner: (/^win/.test(process.platform) ? 'ruby ' : '') + 'bin/rails runner'
}
}]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment