Я пытаюсь добавить поддержку sass и загрузчик изображений webpack для моего следующего приложения вместе с поддержкой экспортируемых маршрутов. У меня проблемы с тем, как составить файл конфигурации. Я не понимаю, как плагин sass добавляется в конфигурацию webpack и как составлять и экспортировать функцию next.config.js.
const fetch = require('isomorphic-unfetch');
var Prismic = require('prismic-javascript');
const withSass = require('@zeit/next-sass')
var apiEndpoint = 'https://apiendpoint/api/v2';
module.exports =
withSass({
async exportPathMap() {
const response = await Prismic.getApi(apiEndpoint)
.then(function (api) {
return api.query(
Prismic.Predicates.at('document.type', 'post')
);
})
.then(
function (response) {
return response.results
},
function (err) {
console.log('Something went wrong: ', err);
}
);
// tranform the list of posts into a map of pages with the pathname `/post/:id`
const pages = await response.reduce((pages, post) =>
Object.assign({}, pages, {
[`/post/${post.id}`]: {
page: '/post',
query: {
id: post.id
}
}
}), {},
)
// combine the map of post pages with the home
return Object.assign({}, pages, {
'/': {
page: '/'
}
})
}
})
Может кто-нибудь помочь?