WebPack是一个现代javaScript应用程序模块打包工具。它有四个核心概念:entry, output, loaders, plugins. 一段代码看懂四个概念:
const HtmlWebpackPlugin = require('html-webpack-plugin'); //installed via npmconst webpack = require('webpack'); //to access built-in pluginsconst path = require('path');const config = { entry: './path/to/my/entry/file.js', output: { path: path.resolve(__dirname, 'dist'), filename: 'my-first-webpack.bundle.js' }, module: { rules: [ {test: //.(js|jsx)$/, use: 'babel-loader'} ] }, plugins: [ new webpack.optimize.Uglifyjsplugin(), new HtmlWebpackPlugin({template: './src/index.html'}) ]};module.exports = config;There are many plugins that webpack内建的plugins
第三方plugins
新闻热点
疑难解答