webpack之旅01-概述

    xiaoxiao2021-03-26  21

    WebPack是一个现代JavaScript应用程序模块打包工具。它有四个核心概念:entry, output, loaders, plugins. 一段代码看懂四个概念:

    const HtmlWebpackPlugin = require('html-webpack-plugin'); //installed via npm const webpack = require('webpack'); //to access built-in plugins const 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

    转载请注明原文地址: https://ju.6miu.com/read-660062.html

    最新回复(0)