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

41 lines
689 B
Markdown

# 基础配置
## 自定义启动端口
```shell
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
devServer: {
port: 3000,
host: "0.0.0.0"
},
})
```
## 自定义样式
```js
// 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)),
},
});
```