This file contains hidden or 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
const CheckerPlugin = require("awesome-typescript-loader").CheckerPlugin; | |
module.exports = { | |
webpack(config, options) { | |
const { dir, defaultLoaders } = options | |
config.pageExtensions.push(".ts", ".tsx"); | |
config.resolve.extensions.push(".ts", ".tsx"); | |
This file contains hidden or 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"); | |
// cacheDirectory option is unavailable in case of useBabel option | |
const fixBabelConfig = omit(defaultLoaders.babel.options, [ |
This file contains hidden or 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"); | |
// ADDED THIS | |
// cacheDirectory option is unavailable in case of useBabel option |
This file contains hidden or 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
Show hidden characters
{ | |
"compilerOptions": { | |
"target": "esnext", | |
"module": "esnext", | |
"jsx": "preserve", | |
"moduleResolution": "node", | |
} | |
} |
This file contains hidden or 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?$/, |
This file contains hidden or 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, { dev }) { | |
// modify it! | |
return config; | |
} | |
} |
This file contains hidden or 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
0499546ea9c2975b26acb86d2ca81e3448e5c1f6e77816d95a5c7981d9b2e6f806407f3bcae0b19f7e86589dfacd98b066cf0b90c5a83dcfb6fa2256a94b16106f |
This file contains hidden or 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
import React from 'react' | |
import NextJsLink from 'next/link' | |
const assetPrefix = process.env.ASSET_PREFIX | |
const Link = ({ href, ...rest }) => ( | |
<NextJsLink href={href} as={`${assetPrefix}${href}`} {...rest} /> | |
) | |
export default Link |
This file contains hidden or 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
import Document, { Head, Main, NextScript } from 'next/document' | |
export default class MyDocument extends Document { | |
render() { | |
return ( | |
<html> | |
<Head> | |
<link | |
rel="stylesheet" | |
href={`${this.props.__NEXT_DATA__.assetPrefix}/_next/static/style.css`} |
This file contains hidden or 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
import Link from 'next/link' | |
export default () => ( | |
<div> | |
<Link href="/page1" as={`${process.env.ASSET_PREFIX}/page1`}> | |
<a>Go to page</a> | |
</Link> | |
Root page | |
</div> | |
) |