1 Star 0 Fork 6

倔强的aben/vertx-web-site

forked from vertx-china/vertx-web-site 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
next.config.js 2.90 KB
一键复制 编辑 原始数据 按行查看 历史
okou19900722 提交于 2021-12-15 11:33 . Merge branch 'english'
const mdxOptions = require("./components/lib/mdx-options")
const svgToMiniDataURI = require("mini-svg-data-uri")
const withPlugins = require("next-compose-plugins")
const isProd = process.env.NODE_ENV === "production"
const mdx = require("@next/mdx")({
options: mdxOptions
})
// configure base path based on environment variable `VERTX_WEBSITE_BASEPATH`
const basePath = (() => {
let p = process.env.VERTX_WEBSITE_BASEPATH || ""
if (!p.startsWith("/")) {
p = `/${p}`
}
if (p.endsWith("/")) {
p = p.substring(0, p.length - 1)
}
return p
})()
const config = {
env: {
basePath,
// URL to the website. MUST NOT end with a slash.
baseUrl: isProd ? `https://vertx.io${basePath}` : `http://localhost:3000${basePath}`,
buildDate: new Date().toISOString()
},
// also render markdown pages
pageExtensions: ["js", "jsx", "md", "mdx"],
// create a folder for each page
trailingSlash: true,
// opt-in to using SWC for minifying JavaScript
// (does not work with the docs search panel yet!)
// swcMinify: true,
// configure base path
basePath,
assetPrefix: basePath,
eslint: {
dirs: ["components", "pages", "docs/metadata"]
},
images: {
// make build compatible with next-optimized-images
disableStaticImages: true
},
// list pages to export
exportPathMap() {
return {
"/": { page: "/" },
"/blog": { page: "/blog/[[...slug]]" },
"/channels": { page: "/channels" },
"/community": { page: "/community" },
"/docs": { page: "/docs/[[...slug]]" },
"/download": { page: "/download" },
"/faq": { page: "/faq" },
"/get-started": { page: "/get-started" },
"/introduction-to-vertx-and-reactive": { page: "/introduction-to-vertx-and-reactive" },
"/materials": { page: "/materials" },
"/translation": { page: "/translation" }
}
},
webpack: (config, { dev, defaultLoaders }) => {
config.module.rules.push({
test: /\.scss$/,
use: [
defaultLoaders.babel,
{
loader: require("styled-jsx/webpack").loader,
options: {
type: (fileName, options) => options.query.type || "scoped"
}
},
"sass-loader"
]
})
config.module.rules.push({
test: /\.(gif|png|jpe?g)$/i,
type: "asset",
use: "image-webpack-loader"
})
config.module.rules.push({
test: /\.svg$/i,
type: "asset",
use: "image-webpack-loader",
generator: {
dataUrl: content => {
content = content.toString()
return svgToMiniDataURI(content)
}
}
})
if (dev) {
config.module.rules.push({
test: /\.jsx?$/,
loader: "eslint-loader",
exclude: [/node_modules/, /\.next/, /out/],
enforce: "pre",
options: {
emitWarning: true
}
})
}
return config
}
}
module.exports = withPlugins([
[mdx]
], config)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wsaben/vertx-web-site.git
git@gitee.com:wsaben/vertx-web-site.git
wsaben
vertx-web-site
vertx-web-site
master

搜索帮助