Challenge - 5 Problems
Webpacker Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediate2:00remaining
What happens when you run
bin/webpack in a Rails app using Webpacker?You run
bin/webpack in your Rails project that uses Webpacker. What is the main result of this command?Attempts:
2 left
💡 Hint
Think about what bundling means for JavaScript files in Rails.
✗ Incorrect
Running
bin/webpack compiles and bundles JavaScript files into optimized packs that Rails can serve efficiently from public/packs.📝 Syntax
intermediate2:00remaining
Which Webpacker config file defines the entry points for JavaScript bundling?
In a Rails app using Webpacker, which file specifies the JavaScript entry points that Webpack uses to start bundling?
Attempts:
2 left
💡 Hint
Look for the JavaScript file that acts as the entry point for bundling.
✗ Incorrect
The
app/javascript/packs/application.js file defines the JavaScript entry points that Webpack uses to start bundling.🔧 Debug
advanced3:00remaining
Why does this Webpacker build fail with a syntax error?
Given this JavaScript pack file content, why does Webpacker fail to build it?
import React from 'react'
import ReactDOM from 'react-dom'
const App = () => {
return Hello World
}
ReactDOM.render( , document.getElementById('root'))
Attempts:
2 left
💡 Hint
Think about what Webpack needs to understand JSX syntax.
✗ Incorrect
Webpack needs Babel configured with a loader to transform JSX into valid JavaScript. Without it, the build fails with a syntax error.
❓ state_output
advanced2:30remaining
What is the output of this Webpacker manifest JSON after bundling?
After running Webpacker, the manifest.json file contains mappings of source files to compiled assets. Given this snippet:
{
"application.js": "/packs/js/application-123abc.js",
"styles.css": "/packs/css/styles-456def.css"
}
What does this mean for the Rails app?Attempts:
2 left
💡 Hint
Think about why hashed filenames are used in web apps.
✗ Incorrect
The manifest maps source files to compiled assets with unique hashes to enable caching and cache busting in browsers.
🧠 Conceptual
expert3:00remaining
Which statement best describes the role of Webpacker in modern Rails apps?
Choose the most accurate description of what Webpacker does in a Rails application.
Attempts:
2 left
💡 Hint
Consider what Webpacker adds to Rails compared to the traditional asset pipeline.
✗ Incorrect
Webpacker integrates modern JavaScript bundling tools into Rails, managing JS and CSS assets but does not fully replace Sprockets.