🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[TOC] ## 配置 ``` # Set a default framework to use # By default, bun will look for an npm package like `bun-framework-${framework}`, followed by `${framework}` framework = "next" logLevel = "debug" # publicDir = "public" # external = ["jquery"] [macros] # Remap any import like this: # import {graphql} from 'react-relay'; # To: # import {graphql} from 'macro:bun-macro-relay'; react-relay = { "graphql" = "bun-macro-relay" } [bundle] saveTo = "node_modules.bun" # Don't need this if `framework` is set, but showing it here as an example anyway entryPoints = ["./app/index.ts"] [bundle.packages] # If you're bundling packages that do not actually live in a `node_modules` folder or do not have the full package name in the file path, you can pass this to bundle them anyway "@bigapp/design-system" = true [dev] # Change the default port from 3000 to 5000 # Also inherited by Bun.serve port = 5000 [define] # Replace any usage of "process.env.bagel" with the string `lox`. # The values are parsed as JSON, except single-quoted strings are supported and `'undefined'` becomes `undefined` in JS. # This will probably change in a future release to be just regular TOML instead. It is a holdover from the CLI argument parsing. "process.env.bagel" = "'lox'" [loaders] # When loading a .bagel file, run the JS parser ".bagel" = "js" [debug] # When navigating to a blob: or src: link, open the file in your editor # If not, it tries $EDITOR or $VISUAL # If that still fails, it will try Visual Studio Code, then Sublime Text, then a few others # This is used by Bun.openInEditor() editor = "code" # List of editors: # - "subl", "sublime" # - "vscode", "code" # - "textmate", "mate" # - "idea" # - "webstorm" # - "nvim", "neovim" # - "vim","vi" # - "emacs" # - "atom" # If you pass it a file path, it will open with the file path instead # It will recognize non-GUI editors, but I don't think it will work yet ``` 说明 ``` framework :指定默认使用的 framework 版本, bun 将根据 bun-framework-${framework} 格式找寻找 npm 包; logLevel :指定 log 级别(可用值 error 、 warn 、 info 和 debug ); publicDir :指定 public 目录; external :指定外部扩展,作用等同于 Webpack 的 externals; macros :宏定义,用于替换 import 路径,比如: import { graphql } from 'react-relay'; 将被转换为 import { graphql } from "macro:bun-macro-relay/bun-macro-relay.tsx"; dev.port :指定服务的监听端口(默认 3000 ); define :作用等同于 Webpack 的 DefinePlugin; loaders :指定各类文件的解析器; ```