node webpack4.6简单配置
2018-07-09 13:48:41来源:博客园 阅读 ()
package.json
{ "name": "his-web", "version": "0.0.0", "description": "HisWeb", "main": "app.js", "author": { "name": "york" }, "devDependencies": { "@types/node": "^6.0.87", "css-loader": "^0.28.11", "html-loader": "^0.5.5", "html-minifier": "^3.5.15", "html-webpack-plugin": "^3.2.0", "purify-css": "^1.2.6", "purifycss-webpack": "^0.7.0", "style-loader": "^0.21.0", "url-loader": "^1.0.1", "webpack-cli": "^2.0.15" }, "dependencies": { "jquery": "^3.3.1", "mini-css-extract-plugin": "^0.4.0", "webpack": "^4.6.0" }, "scripts": { "dev": "webpack --mode development", "build": "webpack --mode production" } }
webpack.config.js 的简单配置
const path = require('path') const webpack = require('webpack') const glob = require('glob') const HtmlWebpackPlugin = require('html-webpack-plugin') const PurifyCssPlugin = require('purifycss-webpack') const MiniCssExtractPlugin = require("mini-css-extract-plugin"); module.exports = { entry: "./script/index.js", output: { path: path.resolve(__dirname, 'dist'), filename: 'index.js' }, module: { rules: [{ test: /\.css$/, use: [ MiniCssExtractPlugin.loader, "css-loader" ] }, { test: /\.html$/, use: 'html-loader', }, { test: /\.(png|jpg|gif)$/, use: [ { loader: 'url-loader', options: { limit: 10000, } } ] } ] }, plugins: [ new MiniCssExtractPlugin({ filename: "[name].css", chunkFilename: "[id].css" }), new HtmlWebpackPlugin({ hash: true, template: './page/index.html', minify: { removeAttributeQuotes: false, // 移除属性的引号 } }), new PurifyCssPlugin({ paths: glob.sync(path.join(__dirname, 'page/*.html')) }), ] }
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
下一篇:Vue状态管理
- JS简单去除数组中重复项的方法 2020-03-16
- JS判断浏览器是否安装flash插件的简单方法 2020-03-12
- nodejs中如何使用async模块 2020-02-22
- JavaScript简单下拉菜单特效 2020-02-22
- nodejs的express自动生成项目框架的方法 2020-02-20
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash