next.js 的babelrc 怎么配置,less怎么配置!

.babel怎么配置
less怎么配置
加了next.config.js 根本不起作用

const withLess = require('@zeit/next-less')

module.exports = withLess({
  webpack: (config, { buildId, dev, isServer, defaultLoaders }) => {
    // Perform customizations to webpack config
    
    // Important: return the modified config
    config.module.rules.push({
        test: /\.less$/,
        use: [{
            loader: "style-loader"
        }, {
            loader: "css-loader"
        }, {
            loader: "less-loader", options: {
                sourceMap: true
            }
        }]
    })
    console.log(config.module.rules, '--')
    return config
  },
  webpackDevMiddleware: config => {
    // Perform customizations to webpack dev middleware config
    // console.log(config, '@@')
    // Important: return the modified config
    return config
  }
})

.babelrc

{
  "presets": [
    []
  ],
  "ignore": []
}

本人刚开始学习next

阅读 5.4k
1 个回答

试试@zeit/next-less

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题