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
新聞熱點
疑難解答