我一直在尝试运行一个本地的 Next.js 项目(版本为12.2.2),但出于某些原因,dev 脚本没有按照预期工作。所有依赖项都已安装,但我仍然无法缩小脚本不起作用的原因。
运行脚本后,终端看起来像这样: 错误 - 请检查您的GenerateSW插件配置: [WebpackGenerateSW] 'reactStrictMode'属性不应该在这里出现。您是想使用'exclude'属性吗?
这是`next.config.js`文件。
这是
运行脚本后,终端看起来像这样: 错误 - 请检查您的GenerateSW插件配置: [WebpackGenerateSW] 'reactStrictMode'属性不应该在这里出现。您是想使用'exclude'属性吗?
这是`next.config.js`文件。
const withPWA = require("next-pwa");
module.exports = withPWA({
reactStrictMode: true,
webpack5: true,
webpack: (config) => {
config.resolve.fallback = { fs: false };
return config;
},
pwa: {
dest: "public",
register: true,
disable: process.env.NODE_ENV === "development",
},
images: {
domains: ["pbs.twimg.com", "img.icons8.com", "gateway.moralisipfs.com", "ipfs.moralis.io", "lh3.googleusercontent.com", "www.artnews.com"],
},
// for running with docker
output: "standalone",
});
这是
package.json
文件。{
"name": "musixverse-client",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"postbuild": "next-sitemap"
},
"dependencies": {
"@headlessui/react": "^1.6.6",
"@heroicons/react": "^1.0.5",
"@walletconnect/web3-provider": "^1.7.8",
"@web3auth/web3auth": "^1.1.1",
"axios": "^0.26.1",
"country-state-city": "^3.0.1",
"magic-sdk": "^8.0.1",
"moralis": "^1.10.0",
"next": "^12.2.2",
"next-pwa": "^5.4.4",
"next-sitemap": "^3.1.16",
"next-themes": "^0.0.15",
"persona": "^4.6.0",
"react": "^17.0.2",
"react-datepicker": "^4.8.0",
"react-dom": "17.0.2",
"react-image-crop": "^8.6.12",
"react-moralis": "^1.4.0",
"react-select": "^5.4.0",
"styled-components": "^5.3.5",
"web3": "^1.7.4"
},
"devDependencies": {
"autoprefixer": "^10.4.7",
"eslint": "8.6.0",
"eslint-config-next": "12.0.7",
"postcss": "^8.4.14",
"tailwindcss": "^3.1.4"
}
}
Node 版本:16.17.0, NPM 版本:8.19.0