我得到一个404错误http://localhost:3002/_next/static/webpack/cbfe56cfa390e6ae.webpack.hot-update.json当我运行我的next.js应用程序
下面是我的next.config.js
const isUnsafeEval =
process.env.NODE_ENV === 'production' ? '' : `'unsafe-eval'`;
const isStrictMode = process.env.NODE_ENV === 'production' ? true : false;
const csp = `
default-src 'self';
script-src 'self' ${isUnsafeEval} https://apis.google.com;
style-src 'self' 'unsafe-inline' https://fonts.googleapis.com;
font-src 'self' https://fonts.gstatic.com;
img-src 'self' https://lh3.googleusercontent.com;
media-src 'self' ;
connect-src 'self' https://storage.googleapis.com;
`;
`;
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: isStrictMode,
async headers() {
return [
{
source: '/(.*)',
headers: [
{
key: 'Content-Security-Policy',
value: csp.replace(/\n/g, ''),
},
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
{
key: 'X-Frame-Options',
value: 'DENY',
},
{
key: 'Referrer-Policy',
value: ' strict-origin-when-cross-origin',
},
{
key: 'Server',
value: 'hello',
},
],
},
];
},
};
module.exports = nextConfig;
我不做任何明确的webpack
每次我得到这个错误:我的终端有- warn Fast Refresh had to perform a full reload.
此消息
尝试清除. next文件夹并重新运行所有npm安装和npm运行开发
1条答案
按热度按时间oxiaedzo1#
在这里找到了我的问题的解决方案:
NextJS issue
TLDR:清除浏览器上该高速缓存
希望对你有帮助。