Shortcuts
Typing out that long Webpack command is boring and opens us up to errors potentially being made (what if we mistype bundle.js and end up generating the wrong file?). Let’s simplify that process for our own sanity.
First, let’s decide that our index.js will be the entry point to our application, which means that it will require all the other files in the application (or rather, it will require a few files that require a few other files, which require a few other files, and so on).
Conversely, our bundle.js will be our output file, where all our bundled code goes.
Those two files, therefore, will always be the arguments we give to the Webpack command in our Terminal. Since they won’t change, let’s configure Webpack to always use them. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access