1. const webpack = require('webpack')
  2. const path = require('path')
  3. // const CompressionWebpackPlugin = require('compression-webpack-plugin');
  4. const productionGzipExtensions = ['js', 'css']
  5. module.exports = {
  6. // 基本路径
  7. publicPath: process.env.NODE_ENV === 'production' ? '/production-sub-path/' : './',
  8. // 输出文件目录
  9. outputDir: 'dist',
  10. // eslint-loader 是否在保存的时候检查
  11. pages: {
  12. index: {
  13. // page 的入口
  14. entry: 'src/dyreleaseweb/main.js',
  15. // 模板来源
  16. template: 'public/index.html',
  17. filename: 'index.html',
  18. favicon: 'public/logo.ico',
  19. // 当使用 title 选项时,
  20. // template 中的 title 标签需要是 <title><%= htmlWebpackPlugin.options.title %></title>
  21. title: '通稿稿件2.0',
  22. // 在这个页面中包含的块,默认情况下会包含
  23. // 提取出来的通用 chunk 和 vendor chunk。
  24. chunks: ['chunk-vendors', 'chunk-common', 'index']
  25. },
  26. topic: {
  27. // page 的入口
  28. entry: 'src/topic/main.js',
  29. // 模板来源
  30. template: 'public/topic.html',
  31. // 在 dist/index.html 的输出
  32. filename: 'topic.html',
  33. favicon: 'public/logo.ico',
  34. title: 'Topic Page',
  35. chunks: ['chunk-vendors', 'chunk-common', 'index']
  36. }
  37. // 当使用只有入口的字符串格式时,
  38. // 模板会被推导为 `public/subpage.html`
  39. // 并且如果找不到的话,就回退到 `public/index.html`。
  40. // 输出文件名会被推导为 `subpage.html`。
  41. // subpage: 'src/subpage/main.js'
  42. },
  43. chainWebpack: () => {},
  44. configureWebpack: {
  45. plugins: [
  46. new webpack.ProvidePlugin({
  47. $: 'jquery',
  48. jQuery: 'jquery',
  49. 'windows.jQuery': 'jquery'
  50. })
  51. ]
  52. },
  53. productionSourceMap: true,
  54. // css相关配置
  55. css: {
  56. // 是否使用css分离插件 ExtractTextPlugin
  57. extract: true,
  58. // 开启 CSS source maps?
  59. sourceMap: false,
  60. // css预设器配置项
  61. loaderOptions: {
  62. css: {
  63.  
  64. },
  65. postcss: {
  66. /* ident: 'postcss',
  67. plugins: (loader) => [
  68. require('postcss-import')({ root: loader.resourcePath }),
  69. require('postcss-preset-env')(),
  70. require('cssnano')()
  71. ] */
  72. }
  73. },
  74. // 启用 CSS modules for all css / pre-processor files.
  75. modules: true // 去掉文件名中的 .module
  76. },
  77. // use thread-loader for babel & TS in production build
  78. // enabled by default if the machine has more than 1 cores
  79. parallel: require('os').cpus().length > ,
  80. // webpack-dev-server 相关配置
  81. devServer: {
  82. open: process.platform === 'darwin',
  83. host: '10.10.0.102',
  84. port: ,
  85. https: false,
  86. hotOnly: false,
  87. proxy: {
  88. '/api': {
  89. target: 'http://10.10.0.102:9010/',
  90. ws: true,
  91. changeOrigin: true,
  92. pathRewrite: {
  93. '^/api': '/gateway'
  94. }
  95. },
  96. '/foo': {
  97. target: '<other_url>'
  98. }
  99. },
  100. before: app => {}
  101. },
  102. // 第三方插件配置
  103. pluginOptions: {
  104. // ...
  105. }
  106. // eslint-disable-next-line eol-last
  107. }

@vue/cli 3配置文件vue.config.js的更多相关文章

  1. [转]Vue CLI 3搭建vue+vuex 最全分析

    原文地址:https://my.oschina.net/wangnian/blog/2051369 一.介绍 Vue CLI 是一个基于 Vue.js 进行快速开发的完整系统.有三个组件: CLI:@ ...

  2. Vue CLI 3搭建vue+vuex 最全分析

    一.介绍 Vue CLI 是一个基于 Vue.js 进行快速开发的完整系统.有三个组件: CLI:@vue/cli 全局安装的 npm 包,提供了终端里的vue命令(如:vue create .vue ...

  3. Vue Cli 3:vue.config.js配置文件

    Vue Cli 3生成的项目结构,没有build.config目录,而是使用vue.config.js来进行配置. vue.config.js 是一个可选的配置文件,如果项目的 (和 package. ...

  4. vue cli 中关于vue.config.js中chainWebpack的配置

    Vue CLI  的官方文档上写:调整webpack配置最简单的方式就是在vue.config.js中的configureWebpack选项提供一个对象. Vue CLI 内部的 webpack 配置 ...

  5. vue --- 解读vue的中webpack.base.config.js

    const path = require('path') const utils = require('./utils')// 引入utils工具模块,具体查看我的博客关于utils的解释,utils ...

  6. vue cli搭建的vue项目 不小心开了eslint 一直报黄色的警告

    报错必须处理,警告也忍不了,发现在bulid -webpack.base.config.js 里找到 const createLintingRule = () => ({ /*test: /\. ...

  7. 使用Vue CLI脚手架搭建vue项目

    本次是使用@vue/cli 3.11.0版本搭建的vue项目 1. 首先确保自己的电脑上的Node.js的版本是8.9版本或者以上 2. 全局安装vue/cli npm install @vue/cl ...

  8. Vue CLI UI:Vue开发者必不可少的工具

    突然发现一个Vue cli 比较好用的工具,一个可视化图形界面方便你去创建.更新和管理Vue项目.这里分享2个作者写得比较好的文章 https://codeseeding.com/portal.php ...

  9. webpack 4.0 配置文件 webpack.config.js文件的放置位置

    一般webpack.config.js是默认放在根目录的,不在根目录的时候需要在package.json中制定位置,我的配置文件目录是config/webpack.config.js,在package ...

随机推荐

  1. MyBatis—mybatis-config.xml配置介绍

    在定义sqlSessionFactory时需要指定MyBatis主配置文件: Xml代码   说明: 收藏代码 1.  <bean id="sqlSessionFactory" ...

  2. python实现指定目录下批量文件的单词计数:并发版本

    在 文章 <python实现指定目录下批量文件的单词计数:串行版本>中, 总体思路是: A. 一次性获取指定目录下的所有符合条件的文件 -> B. 一次性获取所有文件的所有文件行 - ...

  3. 打开 EXCEL时出现RUN-TIME ERROR“91”,怎么解决?

    方法一: 开始—程序—microsoft—打开“windows office 2007 简易设置”,把“使用 office 03样式经典菜单”前的“√”去掉就OK了 方法二: 1. 打开注册表编辑器. ...

  4. 在使用swiper时,解决同一个页面使用多个轮播出现问题做法

    $(".swiper-container").each(function(){ $(this).swiper({ loop: true, initialSlide :0, pagi ...

  5. zabbix-2.4.7环境部署与初始化安装

    一.zabbix简介: zabbix的特点: - 安装与配置简单,学习成本低 - 支持多语言(包括中文) - 免费开源 - 自动发现服务器与网络设备 - 分布式监视以及WEB集中管理功能 - 可以无a ...

  6. 20135302魏静静——Linux课程期中总结

    Linux期中总结 Linux课程第一周实验及总结:[http://www.cnblogs.com/20135302wei/p/5218607.html] 冯诺依曼体系结构的核心思想是存储程序计算机. ...

  7. 20145211黄志远 《网络对抗》Exp7 网络欺诈技术防范

    20145211黄志远 <网络对抗>Exp7 网络欺诈技术防范 本实践的目标理解常用网络欺诈背后的原理,以提高防范意识,并提出具体防范方法.具体有(1)简单应用SET工具建立冒名网站(2) ...

  8. QT+VS中ui不能声明为指针?

    问题描述:QtCreator里的UI全是默认为指针类型,调用的时候[ui->]但是使用VS+Qt来,发来默认的是变量类型,使用的时候[ui.] 统一:为了统一我把后者声明改为前者 问题:在mai ...

  9. autofac &web api 切换数据库

    https://stackoverflow.com/questions/24188025/is-there-another-way-of-changing-database-instance-in-a ...

  10. POJ 1386 Play on Words(欧拉路)

    http://poj.org/problem?id=1386 题意: 给出多个单词,只有单词首字母与上一个单子的末尾字母相同时可以连接,判断所有字母是否可以全部连接在一起. 思路: 判断是否存在欧拉道 ...