webpack.css.config.ts 707 B

12345678910111213141516171819202122232425262728293031323334
  1. /* eslint-env node */
  2. /* eslint import/no-nodejs-modules:0 */
  3. import config from '../webpack.config';
  4. // Select all CSS rules from the base webpack config
  5. const cssRules =
  6. config?.module?.rules?.filter(
  7. ruleSet =>
  8. typeof ruleSet === 'object' &&
  9. ['/\\.css/', '/\\.less$/'].includes(ruleSet.test?.toString() ?? '')
  10. ) ?? [];
  11. config.entry = {
  12. sentry: 'less/jest-ci.less',
  13. };
  14. config.module = {
  15. ...config?.module,
  16. rules: [
  17. ...cssRules,
  18. {
  19. test: /\.(jpe?g|png|gif|ttf|eot|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/,
  20. use: [
  21. {
  22. loader: 'url-loader',
  23. options: {esModule: false, limit: true},
  24. },
  25. ],
  26. },
  27. ],
  28. };
  29. export default config;