/* eslint-disable import/no-extraneous-dependencies */ const fs = require('fs'); const path = require('path'); const paths = require('./paths'); const loaders = require('./loader.dev'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const lessToJs = require('less-vars-to-js'); const themeVariables = lessToJs(fs.readFileSync(path.join(paths.appSrc, 'styles/ant-default.less'), 'utf8')); const iconPath = path.relative('./~/antd/lib/style/*', './src/styles/iconfont/antd-font/iconfont'); themeVariables['@icon-url'] = `'${iconPath}'`; // js & jsx loader const jsLoader = { test: /\.(js|jsx)$/, include: paths.appSrc, exclude: /node_modules/, loader: require.resolve('babel-loader'), }; const cssLoaderRule = { test: /\.css$/, use: [ MiniCssExtractPlugin.loader, loaders.cssLoaderConfig, loaders.postCssLoaderConfig, { loader: 'resolve-url-loader' }, ], }; const scssLoaderRule = { test: /\.(scss|sass)$/, use: [ MiniCssExtractPlugin.loader, loaders.cssLoaderConfig, loaders.postCssLoaderConfig, { loader: 'resolve-url-loader' }, loaders.sassLoaderConfig, ], }; const lessLoaderRule = { test: /\.(less)$/, use: [ MiniCssExtractPlugin.loader, loaders.cssLoaderConfig, loaders.postCssLoaderConfig, { loader: 'resolve-url-loader' }, loaders.lessLoaderConfig, ], }; module.exports = { ...loaders, scssLoaderRule, lessLoaderRule, cssLoaderRule, jsLoader };