Skip to content
This repository has been archived by the owner on Jul 6, 2021. It is now read-only.

Commit

Permalink
Only apply hot-self-accept-loader when on older versions of Next.js (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
timneutkens committed Jun 16, 2018
1 parent 4486bf9 commit 286ef16
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions packages/next-typescript/index.js
Expand Up @@ -30,15 +30,20 @@ module.exports = (nextConfig = {}) => {

config.resolve.extensions.push('.ts', '.tsx')

if (dev && !isServer) {
config.module.rules.push({
test: /\.(ts|tsx)$/,
loader: 'hot-self-accept-loader',
include: [path.join(dir, 'pages')],
options: {
extensions: /\.(ts|tsx)$/
}
})
// Backwards compatibility with older versions of Next.js.
// Next.js will automatically apply hot-self-accept-loader for all extensions in `pageExtensions`
// Which next-typescript adds itself to
if (!defaultLoaders.hotSelfAccept) {
if (dev && !isServer) {
config.module.rules.push({
test: /\.(ts|tsx)$/,
loader: 'hot-self-accept-loader',
include: [path.join(dir, 'pages')],
options: {
extensions: /\.(ts|tsx)$/
}
})
}
}

config.module.rules.push({
Expand Down

0 comments on commit 286ef16

Please sign in to comment.