Fix CORS in service worker (#342)
* Add crossOrigin to generated <script> elements if CDN is used * Add CORS headers to darkmode.js --------- Co-authored-by: ekzyis <ek@stacker.news>
This commit is contained in:
parent
69f6f63b9c
commit
f417092107
@ -30,12 +30,23 @@ module.exports = withPlausibleProxy()({
|
|||||||
generateBuildId: isProd ? async () => commitHash : undefined,
|
generateBuildId: isProd ? async () => commitHash : undefined,
|
||||||
// Use the CDN in production and localhost for development.
|
// Use the CDN in production and localhost for development.
|
||||||
assetPrefix: isProd ? 'https://a.stacker.news' : undefined,
|
assetPrefix: isProd ? 'https://a.stacker.news' : undefined,
|
||||||
|
crossOrigin: isProd ? 'anonymous' : undefined,
|
||||||
async headers () {
|
async headers () {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
source: '/_next/:asset*',
|
source: '/_next/:asset*',
|
||||||
headers: corsHeaders
|
headers: corsHeaders
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
source: '/darkmode.js',
|
||||||
|
headers: [
|
||||||
|
...corsHeaders,
|
||||||
|
{
|
||||||
|
key: 'Cache-Control',
|
||||||
|
value: 'public, max-age=31536000, immutable'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
source: '/Lightningvolt-xoqm.ttf',
|
source: '/Lightningvolt-xoqm.ttf',
|
||||||
headers: [
|
headers: [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user