Skip to content

Instantly share code, notes, and snippets.

@AlexSwtlsk
Created October 9, 2019 08:22
Show Gist options
  • Save AlexSwtlsk/ed6b5479728c9f2e47c6d558e38fedc9 to your computer and use it in GitHub Desktop.
Save AlexSwtlsk/ed6b5479728c9f2e47c6d558e38fedc9 to your computer and use it in GitHub Desktop.
Nuxt - Build options with typescript
import NuxtConfiguration from "@nuxt/config";
import { Configuration as WebpackConfiguration } from "webpack";
import { BlogRaw } from "./types";
const { fr, en } = require("./blog/blogs.json");
import { head } from "./config/head";
export default {
server: {
port: 3003
},
env: {},
head,
loading: { color: "#3B8070" },
css: ["~/assets/css/main.css"],
build: {
extend(config: WebpackConfiguration, ctx) {
config.module.rules.push({
test: /\.md$/,
loader: "frontmatter-markdown-loader"
});
}
},
buildModules: ["@nuxt/typescript-build"],
modules: ["@nuxtjs/axios"],
axios: {},
generate: {
routes: ["404"]
.concat(fr.map((w: BlogRaw) => `/blog/${w.slug}`))
.concat(en.map((w: BlogRaw) => `/blog/en/${w.slug}`))
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment