By Frank Lyder Bredland
A talk about Webpack
You might want to open this presentation on your computer
The presentations URL:
Setup the following in your path:
export PATH=$PATH:./node_modules/.bin
If you don't want to mess with enviroment variables you can install npx
npm i -g npx
But for MacOS and Linux users I recommend the first solution
The presentations URL:
Bundeling it all together
Installing:
npm i --save-dev webpack webpack-cli
Usage:
webpack --mode development
Webpack assumes that the file ./src/index.js exists.
Webpack can be configured to handle all kinds of files
How does webpack handle all these kind of files?
Loaders!
A loader is simply a function that takes some code inn and returns a processed version
module.exports = source => {
return source
.replace(/\<code\>(([\n]|.)+?)\<\/code\>/gi,
(matches, g1) => {
const code = g1.replace(/</g, '<').replace(/>/g, '>');
return `<code>${code}</code>`;
});
One loader you should know about:
debug-loader
Example loader projects