diegohaz / arc

React starter kit based on Atomic Design
https://arc.js.org
2.91k stars 295 forks source link

less-loader for ant-design #340

Open louiskhenghao opened 6 years ago

louiskhenghao commented 6 years ago

Hi guys,

Have anyone of you tried to implement ant-design before? (i am new to webpack..) i have encounter some issue regarding less... And this is the error i got...

/Projects/webapp/node_modules/antd/lib/style/index.less:1
(function (exports, require, module, __filename, __dirname) { @import "./themes/default";
                                                              ^
SyntaxError: Invalid or unexpected token
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:599:28)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Projects/webapp/node_modules/antd/lib/button/style/index.js:3:1)

webpack.config.js Rule i have added to webpack and i actually refer this link and this link

module: {
    rules: [
      {
        test: /\.less$/,
        use: [
          { loader: "style-loader" },
          { loader: "css-loader" },
          { loader: "less-loader" }
        ]
      }
    ]
}

Please share if you have any clue of this 😄 Tqvm