When I'm trying to implement a fallback page, it causes error at build
Versions
next-pwa: 5.6.0
next: 9.5.5
How To Reproduce
Steps to reproduce the behavior:
Create a file named _offline.tsx in pages directory like this:
import { PureComponent } from 'react';
import Head from 'next/head'
export default class Fallback extends PureComponent {
render() {
return (
<>
<Head>
<title>Fallback page</title>
</Head>
<h1>This is fallback page when device is offline</h1>
<h2>When offline, any page route will fallback to this page</h2>
</>
);
}
}
> [PWA] Compile server
Warning: Built-in CSS support is being disabled due to custom CSS configuration being detected.
See here for more info: https://err.sh/next.js/built-in-css-disabled
> [PWA] Compile client (static)
> [PWA] Auto register service worker with: /Users/oujaber/Documents/workspace/wieldyy/user/node_modules/next-pwa/register.js
> [PWA] Service worker: /Users/oujaber/Documents/workspace/wieldyy/user/public/sw.js
> [PWA] url: /sw.js
> [PWA] scope: /
> [PWA] Fallback to precache routes when fetch failed from cache or network:
> [PWA] document (page): /_offline
Build error occurred
WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
configuration.resolve has an unknown property 'fallback'. These properties are valid:
object { alias?, aliasFields?, cachePredicate?, cacheWithContext?, concord?, descriptionFiles?, enforceExtension?, enforceModuleExtension?, extensions?, fileSystem?, mainFields?, mainFiles?, moduleExtensions?, modules?, plugins?, resolver?, roots?, symlinks?, unsafeCache?, useSyncFileSystemCalls? }
-> Options for the resolver
at webpack (/Users/oujaber/Documents/workspace/wieldyy/user/node_modules/webpack/lib/webpack.js:31:9)
at buildFallbackWorker (/Users/oujaber/Documents/workspace/wieldyy/user/node_modules/next-pwa/build-fallback-worker.js:64:3)
at Object.webpack (/Users/oujaber/Documents/workspace/wieldyy/user/node_modules/next-pwa/index.js:184:25)
at getBaseWebpackConfig (/Users/oujaber/Documents/workspace/wieldyy/user/node_modules/next/dist/build/webpack-config.js:134:360)
at async Promise.all (index 0)
at async build (/Users/oujaber/Documents/workspace/wieldyy/user/node_modules/next/dist/build/index.js:11:102)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Link to minimal reproduce setup repository if any.
Expected Behaviors
Build without errors
Additional Context
If I remove file _offline.tsx , it compiles without errors.
Summary
When I'm trying to implement a fallback page, it causes error at build
Versions
next-pwa
: 5.6.0next
: 9.5.5How To Reproduce
Steps to reproduce the behavior:
pages
directory like this:yarn build
Link to minimal reproduce setup repository if any.
Expected Behaviors
Build without errors
Additional Context
If I remove file
_offline.tsx
, it compiles without errors.