Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalidate cache for link[preload] in dev for CSS files #10630

Merged
merged 5 commits into from Feb 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions packages/next/pages/_document.tsx
Expand Up @@ -186,6 +186,7 @@ export class Head extends Component<

getCssLinks(): JSX.Element[] | null {
const { assetPrefix, files } = this.context._documentProps
const { _devOnlyInvalidateCacheQueryString } = this.context
const cssFiles =
files && files.length ? files.filter(f => /\.css$/.test(f)) : []

Expand All @@ -196,15 +197,19 @@ export class Head extends Component<
key={`${file}-preload`}
nonce={this.props.nonce}
rel="preload"
href={`${assetPrefix}/_next/${encodeURI(file)}`}
href={`${assetPrefix}/_next/${encodeURI(
file
)}${_devOnlyInvalidateCacheQueryString}`}
as="style"
crossOrigin={this.props.crossOrigin || process.crossOrigin}
/>,
<link
key={file}
nonce={this.props.nonce}
rel="stylesheet"
href={`${assetPrefix}/_next/${encodeURI(file)}`}
href={`${assetPrefix}/_next/${encodeURI(
file
)}${_devOnlyInvalidateCacheQueryString}`}
crossOrigin={this.props.crossOrigin || process.crossOrigin}
/>
)
Expand Down