nextjs中(目前我是12.x),默认只能引入xxx.module.css,但有些三方组件中会存在引入xx.css的情况, 比如我目前用到的antd-mobile,会出现如下错误:
./node_modules/antd-mobile/es/components/action-sheet/action-sheet.css
Global CSS
be imported from within
Read more: https://nextjs.org/docs/messages/css-npm
Location:
Module build failed: Error: Final loader (./node_modules/next/dist/build/webpack/loaders/error-loader.js) didn’t return a Buffer or String
需要加如下代码处理:
// next.config.js
const withTM = require('next-transpile-modules')(