How to use the customize-cra.override function in customize-cra

To help you get started, we’ve selected a few customize-cra examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github realMorrisLiu / lightmerge / config-overrides.js View on Github external
// module.exports = function override(config, env) {
//     // do stuff with the webpack config...
//     return config;
// }
const { override, fixBabelImports, addLessLoader } = require('customize-cra');

module.exports = override(
  fixBabelImports('import', {
    libraryName: 'antd',
    libraryDirectory: 'es',
    style: true,
  }),
  addLessLoader({
    javascriptEnabled: true,
    modifyVars: {
      '@primary-color': '#1890FF',
    },
  }),
);
github dotnetcore / WTM / demo / WalkingTec.Mvvm.Next / ClientApp / packages / www-react / config-overrides.js View on Github external
const { override, fixBabelImports, addBundleVisualizer, addLessLoader, disableEsLint, babelInclude, addWebpackResolve } = require('customize-cra');
const path = require('path');
module.exports = override(
    // 模块 解析 路径
    // addWebpackResolve({
    //     modules: [
    //         path.resolve(path.dirname(path.dirname(process.cwd())), 'node_modules'),
    //         path.resolve(process.cwd(), 'node_modules'),
    //         path.resolve(process.cwd(), 'src'),
    //     ]
    // }),
    // 添加 需要 编译的目录
    babelInclude([
        // 当前项目
        path.resolve(process.cwd(), 'src'),
        // public 目录
        path.resolve(path.dirname(process.cwd()), 'public', 'src')
    ]),
    // 按需加载
github saasify-sh / saasify / website / config-overrides.js View on Github external
const CompressionPlugin = require('compression-webpack-plugin')
const path = require('path')

// const AntDesignThemePlugin = require('antd-theme-webpack-plugin')

const {
  override,
  addDecoratorsLegacy,
  addBundleVisualizer,
  addBabelPlugin,
  addWebpackAlias,
  addWebpackPlugin,
  disableEsLint
} = require('customize-cra')

module.exports = override(
  addDecoratorsLegacy(),
  disableEsLint(),
  // eslint-disable-next-line
  process.env.BUNDLE_VISUALIZE == 1 && addBundleVisualizer(),
  /*
  // auto-imports for antd; currently we're opting for more manual control in src/lib/antd.js
  fixBabelImports('import', {
    libraryName: 'antd',
    libraryDirectory: 'es',
    style: true
  }),
  addLessLoader({
    javascriptEnabled: true,
    modifyVars: {
      // '@primary-color': '#d23d67'
    }
github snowflakedb / SnowAlert / src / webui / frontend / config-overrides.js View on Github external
const {override, fixBabelImports, addLessLoader} = require('customize-cra');

module.exports = override(
  fixBabelImports('antd', {
    libraryName: 'antd',
    libraryDirectory: 'es',
    style: true,
  }),
  addLessLoader({
    javascriptEnabled: true,
    modifyVars: {
      // Fetch icons locally instead of Alibaba CDN (https://ant.design/docs/react/customize-theme).
      // Latest resource can be found here: https://ant.design/docs/spec/download.
      '@icon-url': '"/iconfont"',
      // Override Ant's LESS constants (https://ant.design/docs/react/use-with-create-react-app).
      '@primary-color': '#00a2ae',
    },
  }),
);
github goblin-laboratory / cra-multi-page-template / config-overrides.js View on Github external
// navigateFallback: paths.servedPath + '/index.html',
      // navigateFallbackBlacklist: [
      //   // Exclude URLs starting with /_, as they're likely an API call
      //   new RegExp('^/_'),
      //   // Exclude URLs containing a dot, as they're likely a resource in
      //   // public/ and not a SPA route
      //   new RegExp('/[^/]+\\.[^/]+$'),
      // ],
    });
    config.plugins.push(workboxWebpackPlugin);
  }
  return config;
};

module.exports = {
  webpack: override(
    supportMultiPage,
    fixBabelImports('import', {
      libraryName: 'antd',
      libraryDirectory: 'es',
      style: true,
    }),
    fixBabelImports('ant-design-pro', {
      libraryName: 'ant-design-pro',
      libraryDirectory: 'lib',
      style: true,
      camel2DashComponentName: false,
    }),
    addLessLoader({
      javascriptEnabled: true,
      localIdentName: '[local]--[hash:base64:5]',
      // modifyVars: { '@primary-color': '#1DA57A' },
github ashik112 / extensive-react-skeleton / config-overrides.js View on Github external
/* eslint-disable */
/* config-overrides.js */
const {
  useBabelRc, override, fixBabelImports, addLessLoader,
} = require('customize-cra');
const path = require('path');
module.exports = override(
  useBabelRc(),
  fixBabelImports('import', {
    libraryName: 'antd',
    libraryDirectory: 'es',
    style: true,
  }),
  addLessLoader({
    javascriptEnabled: true,
    modifyVars: {
      'hack': `true; @import "${ path.resolve(__dirname, 'src/styles/less/theme.less')}";`,// Override with less file
    },
  }),
);
github jigsawye / rosim / config-overrides.js View on Github external
const { addBabelPlugins, override, useEslintRc } = require('customize-cra');

module.exports = override(
  ...addBabelPlugins(
    [
      'import',
      {
        libraryName: 'antd',
        libraryDirectory: 'es',
        style: 'css',
      },
    ],
    ['lodash', { id: ['lodash'] }]
  ),
  useEslintRc()
);
github birkir / prime / packages / prime-ui / config-overrides.js View on Github external
const primeConfig = require('rc')('prime', {
  fields: [
    '@primecms/field-asset',
    '@primecms/field-boolean',
    '@primecms/field-datetime',
    '@primecms/field-document',
    '@primecms/field-geopoint',
    '@primecms/field-group',
    '@primecms/field-number',
    '@primecms/field-select',
    '@primecms/field-slice',
    '@primecms/field-string',
  ],
});

module.exports = override(
  fixBabelImports('import', {
    libraryName: 'antd',
    libraryDirectory: 'es',
    style: true,
  }),
  addLessLoader({
    javascriptEnabled: true,
    modifyVars: {
      '@primary-color': '#318E9F',
      '@link-color': '#318E9F',
      '@font-family':
        '"Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
      '@code-family':
        '"Source Code Pro", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;',
      '@font-size-base': '16px',
      '@layout-header-background': '#1F3E44',
github kevinfaguiar / oldschool-react / config-overrides.js View on Github external
const { override, fixBabelImports, addLessLoader } = require('customize-cra');
const path = require('path');

module.exports = override(
  fixBabelImports('import', {
    libraryName: 'antd',
    libraryDirectory: 'lib',
    style: true,
  }),
  addLessLoader({
    javascriptEnabled: true,
    modifyVars: {
      '@primary-color': '#ff6347',
      '@error-color': '#ff6347',
      '@btn-primary-color': '#2c313a',
      '@layout-body-background': '#424a57',
      '@layout-header-background': '#373e49',
      '@layout-footer-background': '#2c313a',
      '@layout-sider-background': '#373e49',
      '@label-required-color': '#FFF37F',