diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..65f181c --- /dev/null +++ b/.vscode/launch.json @@ -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 + } + ] +} diff --git a/next.config.js b/next.config.js index 12fb200..c9a8f7b 100644 --- a/next.config.js +++ b/next.config.js @@ -1,8 +1,8 @@ -const { withContentlayer } = require('next-contentlayer') +const { withContentlayer } = require('next-contentlayer'); const withBundleAnalyzer = require('@next/bundle-analyzer')({ enabled: process.env.ANALYZE === 'true', -}) +}); // You might need to insert additional domains in script-src if you are using external services const ContentSecurityPolicy = ` @@ -14,7 +14,7 @@ const ContentSecurityPolicy = ` connect-src *; font-src 'self' comment.ivanli.cc localhost:8080; frame-src giscus.app -` +`; const securityHeaders = [ // https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP @@ -52,13 +52,13 @@ const securityHeaders = [ key: 'Permissions-Policy', value: 'camera=(), microphone=(), geolocation=()', }, -] +]; /** * @type {import('next/dist/next-server/server/config').NextConfig} **/ module.exports = () => { - const plugins = [withContentlayer, withBundleAnalyzer] + const plugins = [withContentlayer, withBundleAnalyzer]; return plugins.reduce((acc, next) => next(acc), { reactStrictMode: true, pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'], @@ -66,26 +66,32 @@ module.exports = () => { dirs: ['app', 'components', 'layouts', 'scripts'], }, 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: { appDir: true, }, - async headers() { - return [ - { - source: '/(.*)', - headers: securityHeaders, - }, - ] - }, + output: 'export', + // async headers() { + // return [ + // { + // source: '/(.*)', + // headers: securityHeaders, + // }, + // ] + // }, webpack: (config, options) => { config.module.rules.push({ test: /\.svg$/, use: ['@svgr/webpack'], - }) + }); - return config + return config; }, - }) -} + }); +};