我觉得有个主要问题没解决
如果项目中有几十个页面,难道要搞个几十个webpackhtmlplugin的配置,写写都会烦死吧
如果项目中有几十个页面,难道要搞个几十个webpackhtmlplugin的配置,写写都会烦死吧
2017-07-23
处理多个文件:可以通过仅修改 entry 对象来指定任意数量的 entry 或 output 点。
JavaScript 代码:
const path = require('path');const webpack = require('webpack');module.exports = {context: path.resolve(__dirname, './src'),entry: {app: ['./home.js', './events.js', './vendor.js'],},output: {path: path.resolve(__dirname, './dist'),filename: '[name].bundle.js',},};
多个文件,多个输出
JavaScript 代码:
const path = require('path');const webpack = require('webpack');module.exports = {context: path.resolve(__dirname, './src'),entry: {home: './home.js',events: './events.js',contact: './contact.js',},output: {path: path.resolve(__dirname, './dist'),filename: '[name].bundle.js',},};
这是webpack2
举报