zoukankan      html  css  js  c++  java
  • @vue/cli 3配置文件vue.config.js

    const webpack = require('webpack')
    const path = require('path')
        // const CompressionWebpackPlugin = require('compression-webpack-plugin');
    const productionGzipExtensions = ['js', 'css']
    module.exports = {
        // 基本路径
        publicPath: process.env.NODE_ENV === 'production' ? '/production-sub-path/' : './',
        // 输出文件目录
        outputDir: 'dist',
        // eslint-loader 是否在保存的时候检查
        pages: {
            index: {
                // page 的入口
                entry: 'src/dyreleaseweb/main.js',
                // 模板来源
                template: 'public/index.html',
                filename: 'index.html',
                favicon: 'public/logo.ico',
                // 当使用 title 选项时,
                // template 中的 title 标签需要是 <title><%= htmlWebpackPlugin.options.title %></title>
                title: '通稿稿件2.0',
                // 在这个页面中包含的块,默认情况下会包含
                // 提取出来的通用 chunk 和 vendor chunk。
                chunks: ['chunk-vendors', 'chunk-common', 'index']
            },
            topic: {
                // page 的入口
                entry: 'src/topic/main.js',
                // 模板来源
                template: 'public/topic.html',
                // 在 dist/index.html 的输出
                filename: 'topic.html',
                favicon: 'public/logo.ico',
                title: 'Topic Page',
                chunks: ['chunk-vendors', 'chunk-common', 'index']
            }
            // 当使用只有入口的字符串格式时,
            // 模板会被推导为 `public/subpage.html`
            // 并且如果找不到的话,就回退到 `public/index.html`。
            // 输出文件名会被推导为 `subpage.html`。
            //   subpage: 'src/subpage/main.js'
        },
        chainWebpack: () => {},
        configureWebpack: {
            plugins: [
                new webpack.ProvidePlugin({
                    $: 'jquery',
                    jQuery: 'jquery',
                    'windows.jQuery': 'jquery'
                })
            ]
        },
        productionSourceMap: true,
        // css相关配置
        css: {
            // 是否使用css分离插件 ExtractTextPlugin
            extract: true,
            // 开启 CSS source maps?
            sourceMap: false,
            // css预设器配置项
            loaderOptions: {
                css: {
    
                },
                postcss: {
                    /*  ident: 'postcss',
                             plugins: (loader) => [
                                 require('postcss-import')({ root: loader.resourcePath }),
                                 require('postcss-preset-env')(),
                                 require('cssnano')()
                             ] */
                }
            },
            // 启用 CSS modules for all css / pre-processor files.
            modules: true // 去掉文件名中的 .module
        },
        // use thread-loader for babel & TS in production build
        // enabled by default if the machine has more than 1 cores
        parallel: require('os').cpus().length > 1,
        // webpack-dev-server 相关配置
        devServer: {
            open: process.platform === 'darwin',
            host: '10.10.0.102',
            port: 8066,
            https: false,
            hotOnly: false,
            proxy: {
                '/api': {
                    target: 'http://10.10.0.102:9010/',
                    ws: true,
                    changeOrigin: true,
                    pathRewrite: {
                        '^/api': '/gateway'
                    }
                },
                '/foo': {
                    target: '<other_url>'
                }
            },
            before: app => {}
        },
        // 第三方插件配置
        pluginOptions: {
            // ...
        }
        // eslint-disable-next-line eol-last
    }
  • 相关阅读:
    bootstrap入门基础
    java遇见的问题分析
    蓝桥杯练习
    win7 在文件夹上右键后 以管理员启动命令窗口
    渲染10万条数据的性能问题
    闲聊一下百度的Unit
    利用c# 多屏显示
    学习Xposed --记WX功能分析的过程
    从零开始打jar包--补充
    修改windows7 的管理员密码
  • 原文地址:https://www.cnblogs.com/phoebeyue/p/10578904.html
Copyright © 2011-2022 走看看