为什么需要构建工具

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/52e8b3a9-7d72-4cb4-b6c7-2ce8a503a026/Untitled.png

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/892f95c1-2909-4274-88b0-0cad10f36e35/Untitled.png

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/de3b2ecf-f5e3-4e1d-a848-0e7b775aee55/Untitled.png

配置

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/8da0572d-12b7-4431-9ea1-c9fbfc19855e/Untitled.png

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/fdd7f7ea-b2be-4ea6-a824-a41de547c31c/Untitled.png

Loader

module.exports = {
    module: {
        rules: [
            {
                test: /正则表达式/,
                use: 'xxx-loader'
            }, {
                test: /正则表达式/,
                use: ['xxx-loader', 'xxx-loader']
            },{
                test: /正则表达式/,
                use: {
                    loader: 'xxx-loader',
                    options: {
                        presets: ['xxx']
                    },
                }
            }
        ]
    }
}

Lint 代码静态检查