avatar

sunday

Sunday's Blog

  • 首页
Home vue3的vue.config.js的一些项目基础配置
文章

vue3的vue.config.js的一些项目基础配置

Posted 2021-06-26 Updated 2024-01- 2
By sunday
4~6 min read
const autoprefixer = require("autoprefixer");
const pxtorem = require("postcss-pxtorem");

module.exports = {
  chainWebpack: (config) => {
    // 配置启用sass scss
    config.module
      .rule("less")
      .use("less-loader")
      .loader("less-loader")
      .options({
        lessOptions: {
          /**less-loader 配置 */
          strictMath: true,
          noIeCompat: true,
        },
      });
    // 配置网站的 title 标题
    config.plugin("html").tap((args) => {
      args[0].title = "your site title";
      return args;
    });
  },
  outputDir: "dist",
  publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
// 移动端像素转换配置
  css: {
    loaderOptions: {
      postcss: {
        plugins: [
          autoprefixer(),
          pxtorem({
            rootValue: 37.5,
            propList: ["*"],
          }),
        ],
      },
    },
  },
// 本地开发代理设置
  devServer: {
    open: false,
    // 跨域
    proxy: {
      "/api/": {
        // target: "https://your.domain/",
        target: "https://your.domain/",
        changeOrigin: true,
      },
    },
  },
};

vue
vue3
License:  CC BY 4.0
Share

Further Reading

May 23, 2024

vue3除index.html外,所有静态资源部署到阿里云oss上

1.在vite.config.js 中配置 base路径 import { defineConfig, loadEnv } from 'vite' const root = process.cwd() export default defineConfig(({ mode }) => { con

May 20, 2024

阿里云oss部署vue3单页应用/静态文件

1.将你打包的dist文件上传到你创建的Bucket中,可使用官方工具ossbrowser 可到这个地址下载:https://h

Jun 27, 2021

spa单页应用seo优化方案——启动无头浏览器预渲染

spa单页应用seo优化方案——启动无头浏览器预渲染, 使用headerless chromuim开启seo服务 解决单页应用的seo问题,且不用改spa单页应用的代码

OLDER

centos快速安装最新版nodejs

NEWER

spa单页应用seo优化方案——启动无头浏览器预渲染

Recently Updated

  • nextjs15使用better-sqlite3的连接报错问题
  • nextjs + clerk + supabase + realtime 实时监听数据库更改
  • 解决nextjs15使用useLocalStorage报错的问题
  • mac上使用nodejs appium控制chrome浏览器
  • 2024年终总结

Trending Tags

nginx acme 强制跳转HTTPS nodejs 代理 mac 神器 vue3 工具 docker

Contents

©2025 sunday. Some rights reserved.

Using the Halo theme Chirpy