mirror of
https://github.com/morten-olsen/morten-olsen.github.io.git
synced 2026-02-08 01:46:28 +01:00
32 lines
819 B
JavaScript
32 lines
819 B
JavaScript
exports.withGoodwrites = (nextConfig = {}) => ({
|
|
...nextConfig,
|
|
webpack(config, options) {
|
|
const { isServer, dev } = options;
|
|
let outputPath = "";
|
|
if (isServer && dev) {
|
|
outputPath = "../";
|
|
} else if (isServer) {
|
|
outputPath = "../../";
|
|
}
|
|
config.module.rules.push({
|
|
test: /article.yml$/,
|
|
use: [
|
|
{
|
|
loader: require.resolve("@morten-olsen/goodwrites-webpack-loader"),
|
|
options: {
|
|
publicPath: `${
|
|
nextConfig.assetPrefix || nextConfig.basePath || ""
|
|
}/_next/static/assets/`,
|
|
outputPath: `${outputPath}static/assets/`,
|
|
},
|
|
},
|
|
],
|
|
});
|
|
if (typeof nextConfig.webpack === "function") {
|
|
return nextConfig.webpack(config, options);
|
|
}
|
|
|
|
return config;
|
|
},
|
|
});
|