learn_nuxt/packages/3-baseconfig/README.md
2023-05-04 15:42:44 +08:00

689 B

基础配置

自定义启动端口

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
    devServer: {
        port: 3000,
        host: "0.0.0.0"
    },
})

自定义样式

// https://nuxt.com/docs/api/configuration/nuxt-config
import { fileURLToPath } from "node:url";

export default defineNuxtConfig({
  srcDir: "src",
  devServer: {
    port: 3000,
    host: "0.0.0.0",
  },
  vite: {
    css: {
      preprocessorOptions: {
        scss: {
          additionalData: '@import "@/style/index.scss";',
        },
      },
    },
  },
  alias: {
    "@": fileURLToPath(new URL("./src/", import.meta.url)),
  },
});