webpack.config.js 957 B

1234567891011121314151617181920212223242526272829
  1. const path = require('path');
  2. const fs = require('fs');
  3. const autoPrefixer = require('autoPrefixer');
  4. const appDirectory = fs.realpathSync(process.cwd());
  5. const loaders = require('../config/loader.dev');
  6. const lessToJs = require('less-vars-to-js');
  7. const themeVariables = lessToJs(
  8. fs.readFileSync(path.resolve(appDirectory, 'src/styles/ant-default-vars.less'), 'utf8')
  9. );
  10. themeVariables['@icon-url'] = `${path.relative('./~/antd/lib/style/*', './src/styles/iconfont/antd-font/iconfont')}`;
  11. module.exports = {
  12. resolve: {
  13. modules: [path.resolve(appDirectory, 'src'), path.resolve(appDirectory, 'node_modules')],
  14. extensions: ['.jsx', '.js', '.scss', '.css', '.json'],
  15. },
  16. module: {
  17. rules: [
  18. loaders.cssLoaderRule,
  19. loaders.scssLoaderRule,
  20. loaders.lessLoaderRule,
  21. loaders.svgSpriteLoader,
  22. loaders.fontWoffLoader,
  23. loaders.fontTtfLoader,
  24. loaders.imageLoader,
  25. loaders.mediaLoader,
  26. ],
  27. },
  28. };