WebPack是一個(gè)現(xiàn)代javaScript應(yīng)用程序模塊打包工具。它有四個(gè)核心概念:entry, output, loaders, plugins. 一段代碼看懂四個(gè)概念:
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內(nèi)建的plugins
第三方plugins
新聞熱點(diǎn)
疑難解答
圖片精選