Last active
July 17, 2023 08:52
-
-
Save saitonakamura/db05670a637da0247022e9808bc0ec09 to your computer and use it in GitHub Desktop.
Next.js Awesome Typescript integration: how to add awesome-typescript-loader to Next.js webpack config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
webpack(config, options) { | |
const { dir, defaultLoaders } = options | |
config.pageExtensions.push(".ts", ".tsx"); | |
config.resolve.extensions.push(".ts", ".tsx"); | |
config.module.rules.push({ | |
test: /\.tsx?$/, | |
include: [dir], | |
exclude: /node_modules/, | |
use: [ | |
defaultLoaders.babel, | |
{ | |
loader: "awesome-typescript-loader",, | |
}, | |
], | |
}); | |
return config; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment