1
0
Fork 0
freesewing/packages/freesewing.shared/config/next.mjs

58 lines
1.4 KiB
JavaScript
Raw Normal View History

2021-12-11 14:04:05 +01:00
import path from 'path'
import remarkGfm from 'remark-gfm'
import remarkJargon from '../remark-jargon/src/index.js'
import { jargon } from '@freesewing/i18n'
2021-12-11 14:04:05 +01:00
const config = site => ({
experimental: {
externalDir: true,
esmExternals: true,
},
2021-12-18 09:54:53 +01:00
pageExtensions: [ 'js', 'md' ],
webpack: (config, options) => {
// Fixes npm packages that depend on node modules
if (!options.isServer) {
config.resolve.fallback.fs = false
2021-12-11 14:04:05 +01:00
config.resolve.fallback.path = false
config.resolve.fallback.child_process = false
}
// MDX support
config.module.rules.push({
test: /\.md?$/,
use: [
options.defaultLoaders.babel,
{
loader: '@mdx-js/loader',
//providerImportSource: '@mdx-js/react',
options: {
remarkPlugins: [
remarkGfm,
[remarkJargon, { jargon } ],
]
}
}
]
})
2021-12-11 14:04:05 +01:00
// Fix for nextjs bug #17806
config.module.rules.push({
test: /index.mjs$/,
type: "javascript/auto",
resolve: {
fullySpecified: false
}
})
2021-12-11 14:04:05 +01:00
// Aliases
config.resolve.alias.shared = path.resolve('../freesewing.shared/')
config.resolve.alias.site = path.resolve(`../freesewing.${site}/`)
2021-12-18 09:54:53 +01:00
config.resolve.alias.markdown = path.resolve(`../../markdown/${site}/`)
2021-12-11 14:04:05 +01:00
return config
}
2021-12-11 14:04:05 +01:00
})
export default config