const pkg = require("./package"); module.exports = { mode: "spa", env: { BASE_URL: process.env.BASE_URL, NODE_ENV: process.env.NODE_ENV }, server: { host: "0.0.0.0", port: 3001 }, /** * 打包文件 */ build: { vendor: ["axios", "element-ui"] }, /* ** Headers of the page */ head: { title: "程序员客栈后台", meta: [ { charset: "utf-8" }, { name: "viewport", content: "width=device-width, initial-scale=1" }, { hid: "description", name: "description", content: "程序员客栈后台" } ], link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" }] }, /* ** Customize the progress-bar color */ loading: { color: "#fff" }, /* ** Global CSS */ css: [ "element-ui/lib/theme-chalk/index.css", "@/assets/css/common.css", "./styles/index.scss" ], /* ** Plugins to load before mounting the App */ plugins: ["@/plugins/element-ui", "@/plugins/http", "@/plugins/quill"], /* ** Nuxt.js modules */ modules: [ // Doc: https://github.com/nuxt-community/axios-module#usage "@nuxtjs/axios", "@nuxtjs/proxy" ], /* ** Axios module configuration */ axios: { // See https://github.com/nuxt-community/axios-module#options }, /** * Proxy */ proxy: [ ["/api", { target: "http://local.proginn.com/", changeOrigin: true }] ], /* ** Build configuration */ build: { /* ** You can extend webpack config here */ extractCSS: { allChunks: true }, // css 独立打包 link 的形式加载 splitChunks: { chunks: "all", automaticNameDelimiter: "." }, optimization: { splitChunks: { cacheGroups: { commons: { name: "commons", chunks: "all", minChunks: 2, priority: 0, minSize: 1 }, vendor: { name: "vendor", test: /[\\/]node_modules[\\/]/, chunks: "all", priority: 10 } } }, }, publicPath:process.env.NODE_ENV=="dev"?"_nuxtboss":"_nuxt", extend(config, ctx) { } }, router: { middleware: "initialize" } };