build(ci): 修复构建问题。
Some checks failed
🚀 Build and deploy by ftp / 🎉 Deploy (push) Failing after 5m58s

This commit is contained in:
Ivan Li 2023-09-10 09:56:05 +00:00
parent 87d7f43afb
commit 87f9e54318
2 changed files with 40 additions and 18 deletions

16
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:3000/",
"runtimeArgs": ["--disable-web-security", "--enable-precise-memory-info"],
"userDataDir": true
}
]
}

View File

@ -1,8 +1,8 @@
const { withContentlayer } = require('next-contentlayer') const { withContentlayer } = require('next-contentlayer');
const withBundleAnalyzer = require('@next/bundle-analyzer')({ const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true', enabled: process.env.ANALYZE === 'true',
}) });
// You might need to insert additional domains in script-src if you are using external services // You might need to insert additional domains in script-src if you are using external services
const ContentSecurityPolicy = ` const ContentSecurityPolicy = `
@ -14,7 +14,7 @@ const ContentSecurityPolicy = `
connect-src *; connect-src *;
font-src 'self' comment.ivanli.cc localhost:8080; font-src 'self' comment.ivanli.cc localhost:8080;
frame-src giscus.app frame-src giscus.app
` `;
const securityHeaders = [ const securityHeaders = [
// https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP // https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
@ -52,13 +52,13 @@ const securityHeaders = [
key: 'Permissions-Policy', key: 'Permissions-Policy',
value: 'camera=(), microphone=(), geolocation=()', value: 'camera=(), microphone=(), geolocation=()',
}, },
] ];
/** /**
* @type {import('next/dist/next-server/server/config').NextConfig} * @type {import('next/dist/next-server/server/config').NextConfig}
**/ **/
module.exports = () => { module.exports = () => {
const plugins = [withContentlayer, withBundleAnalyzer] const plugins = [withContentlayer, withBundleAnalyzer];
return plugins.reduce((acc, next) => next(acc), { return plugins.reduce((acc, next) => next(acc), {
reactStrictMode: true, reactStrictMode: true,
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'], pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
@ -66,26 +66,32 @@ module.exports = () => {
dirs: ['app', 'components', 'layouts', 'scripts'], dirs: ['app', 'components', 'layouts', 'scripts'],
}, },
images: { images: {
domains: ['pan.ivanli.cc', 'i.creativecommons.org', 'minio.ivanli.cc', 's3.ivanli.cc'], domains: [
'pan.ivanli.cc',
'i.creativecommons.org',
'minio.ivanli.cc',
's3.ivanli.cc',
],
}, },
experimental: { experimental: {
appDir: true, appDir: true,
}, },
async headers() { output: 'export',
return [ // async headers() {
{ // return [
source: '/(.*)', // {
headers: securityHeaders, // source: '/(.*)',
}, // headers: securityHeaders,
] // },
}, // ]
// },
webpack: (config, options) => { webpack: (config, options) => {
config.module.rules.push({ config.module.rules.push({
test: /\.svg$/, test: /\.svg$/,
use: ['@svgr/webpack'], use: ['@svgr/webpack'],
}) });
return config return config;
}, },
}) });
} };