标签:应用 模块 optimize via module pre load exports install
Webpack是一个针对JavaScript应用的打包工具,它按以下步骤来执行打包过程:
Webpack包括4个核心概念
请参看下面例子:
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: /\.txt$/, use: ‘raw-loader‘ } ] }, plugins: [ new webpack.optimize.UglifyJsPlugin(), new HtmlWebpackPlugin({template: ‘./src/index.html‘}) ] }; module.exports = config;
标签:应用 模块 optimize via module pre load exports install
原文地址:http://www.cnblogs.com/jinzd/p/7770628.html