Next.js 无样式的Nextjs 10.0版本
大家好,有人能帮助我们进行NextJSV10构建吗?它构建时没有样式:| 这是我的package.json和next.config.jsNext.js 无样式的Nextjs 10.0版本,next.js,Next.js,大家好,有人能帮助我们进行NextJSV10构建吗?它构建时没有样式:| 这是我的package.json和next.config.js 我在_app.js中导入所有样式,它也在chrome network->preview中提供,没有样式 在vercel上一切正常,但当我尝试在我的计算机上构建时,它没有样式:| ** next.config.js ** package.json { "name": "mine", "version&qu
我在_app.js中导入所有样式,它也在chrome network->preview中提供,没有样式 在vercel上一切正常,但当我尝试在我的计算机上构建时,它没有样式:| ** next.config.js ** package.json
{
"name": "mine",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "next",
"build": "next build",
"start": "next start",
"prod:build": "SET NODE_ENV=production && next build && next export",
"export": "next build && next export"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@fortawesome/fontawesome-free": "^5.13.1",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "^4.0.0-alpha.57",
"add": "^2.0.6",
"axios": "^0.19.2",
"chart.js": "^2.9.3",
"date-fns": "^2.16.1",
"draft-js": "^0.11.7",
"es6-shim": "^0.35.6",
"js-cookie": "^2.2.1",
"jwt-decode": "^3.0.0",
"moment": "^2.27.0",
"next": "10.0.0",
"react": "17.0.1",
"react-chartjs-2": "^2.9.0",
"react-dom": "17.0.1",
"react-facebook": "^8.1.4",
"react-lottie": "^1.2.3",
"react-transition-group": "^4.4.1",
"yarn": "^1.22.10"
},
"devDependencies": {
"@types/cookie": "^0.4.0",
"clsx": "^1.1.1",
"cookie": "^0.4.1",
"prop-types": "^15.7.2",
"react-date-range": "^1.0.3",
"react-reveal": "^1.2.2",
"react-slick": "^0.26.1",
"react-toastify": "^6.0.8",
"slick-carousel": "^1.8.1",
"sweetalert2": "^9.15.2"
}
}
确保使用合适的css加载程序。我面对同样的问题,用这个解决了
loaders: ['style-loader', 'css-loader', 'less-loader']
My next.config.js
module.exports = withImages({
target: 'serverless',
webpack: function (config, { webpack }) {
config.module.rules.push({
test: /\.(eot|svg|gif|md)$/,
loaders: ['style-loader', 'css-loader', 'less-loader']
})
return config
},
})
确保使用合适的css加载程序。我面对同样的问题,用这个解决了
loaders: ['style-loader', 'css-loader', 'less-loader']
My next.config.js
module.exports = withImages({
target: 'serverless',
webpack: function (config, { webpack }) {
config.module.rules.push({
test: /\.(eot|svg|gif|md)$/,
loaders: ['style-loader', 'css-loader', 'less-loader']
})
return config
},
})