Skip to content

kenpeter/webpack_glossary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 

Repository files navigation

Intro

I found that there are lots of unfamiliar terms in Webpack configuration. When I first time encounter those terms, I read the official doc, examples, Stackoverflow, etc. I still have no idea what they are talking about, but I am able to find a better explanation in a Youtube video. This repository hosts video (mostly) and text explanation of a particular term in Webpack. Contribution is welcome and sorry about my English.

I realise that it is very important to know a particular term in deeper level.

Sample Webpack config file from here

var path = require('path');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var CleanWebpackPlugin = require('clean-webpack-plugin');

var extractPlugin = new ExtractTextPlugin({
   filename: 'main.css'
});

module.exports = {
    entry: './src/js/app.js',
    output: {
        path: path.resolve(__dirname, 'dist'),
        filename: 'bundle.js',
        // publicPath: '/dist'
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                use: [
                    {
                        loader: 'babel-loader',
                        options: {
                            presets: ['es2015']
                        }
                    }
                ]
            },
            {
                test: /\.scss$/,
                use: extractPlugin.extract({
                    use: ['css-loader', 'sass-loader']
                })
            },
            {
                test: /\.html$/,
                use: ['html-loader']
            },
            {
                test: /\.(jpg|png)$/,
                use: [
                    {
                        loader: 'file-loader',
                        options: {
                            name: '[name].[ext]',
                            outputPath: 'img/',
                            publicPath: 'img/'
                        }
                    }
                ]
            }
        ]
    },
    plugins: [
        extractPlugin,
        new HtmlWebpackPlugin({
            template: 'src/index.html'
        }),
        new CleanWebpackPlugin(['dist'])
    ]
};

What is Webpack?

What is single entry point in Webpack?

  • Starting point of your app.
const config = {
  entry: './path/to/my/entry/file.js'
};

module.exports = config;

Webpack multiple entry points

Path

What is output?

What is output path?

What is output filename?

  • /path/to/your/project/dist/bundle.js. It writes into disk.

What is publicPath in output?

What is module?

What is rule in module?

What is test in rule in module?

What is use in rule in module?

Style loader before css loader in module

What is plugin?

What is extract-text-webpack-plugin?

What is babel loader?

What is babel?

What is preset?

What is stage-0, stage-1, etc?

ES5, ES6, ES2015, etc, confused?

HTML an Image loader

What is html-webpack-plugin?

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages