diff --git a/build-fallback-worker.js b/build-fallback-worker.js index af3ce017..bdffc5fc 100644 --- a/build-fallback-worker.js +++ b/build-fallback-worker.js @@ -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) { @@ -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` diff --git a/index.js b/index.js index cc002cc6..8cb8849c 100644 --- a/index.js +++ b/index.js @@ -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 @@ -182,7 +182,8 @@ module.exports = (nextConfig = {}) => ({ } }) }, - minify: !dev + minify: !dev, + pageExtensions }) }