Skip to content

Commit

Permalink
Add support for pageExtensions
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowwalker committed Aug 16, 2021
1 parent fb1c0fd commit 67e4d58
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions build-fallback-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const getFallbackEnvs = ({fallbacks, basedir, id}) => {

if (!pagesDir) return

const offlines = ['tsx', 'ts', 'jsx', 'js', 'mdx']
const offlines = pageExtensions
.map(ext => path.join(pagesDir, `_offline.${ext}`))
.filter(entry => fs.existsSync(entry))
if (offlines.length === 1) {
Expand Down Expand Up @@ -54,8 +54,8 @@ const getFallbackEnvs = ({fallbacks, basedir, id}) => {
return envs
}

const buildFallbackWorker = ({ id, fallbacks, basedir, destdir, success, minify }) => {
const envs = getFallbackEnvs({fallbacks, basedir, id})
const buildFallbackWorker = ({ id, fallbacks, basedir, destdir, success, minify, pageExtensions }) => {
const envs = getFallbackEnvs({fallbacks, basedir, id, pageExtensions})
if (!envs) return false

const name = `fallback-${id}.js`
Expand Down
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = (nextConfig = {}) => ({
webpack,
buildId,
dev,
config: { distDir = '.next', pwa = {}, experimental = {}}
config: { distDir = '.next', pwa = {}, pageExtensions = ['tsx', 'ts', 'jsx', 'js', 'mdx'], experimental = {}}
} = options

let basePath = options.config.basePath
Expand Down Expand Up @@ -182,7 +182,8 @@ module.exports = (nextConfig = {}) => ({
}
})
},
minify: !dev
minify: !dev,
pageExtensions
})
}

Expand Down

0 comments on commit 67e4d58

Please sign in to comment.