How to use the customize-cra.addWebpackResolve 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 seashell / drago / ui / config / rewired / index.js View on Github external
const path = require('path')

const { override, useBabelRc, useEslintRc, addWebpackResolve } = require('customize-cra')

const rewireStyledComponents = require('react-app-rewire-styled-components')
const resolve = require('../webpack/resolve')

module.exports = {
  webpack: override(
    addWebpackResolve(resolve),
    // eslint-disable-next-line react-hooks/rules-of-hooks
    // useBabelRc(path.resolve(__dirname, '..', '..', '.babelrc')),
    // eslint-disable-next-line react-hooks/rules-of-hooks
    // useEslintRc(path.resolve(__dirname, '..', '..', '.eslintrc')),
    (config, env) => rewireStyledComponents(config, env, {})
  ),
}
github chenxiaolei / ZLMediaKit_NVR_UI / config-overrides.js View on Github external
const path = require('path');
const {override, useEslintRc, fixBabelImports, addBabelPresets, addBabelPlugins, addWebpackResolve, addLessLoader, addDecoratorsLegacy} = require('customize-cra');
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');

module.exports = override(
    useEslintRc(),
    addLessLoader({
        javascriptEnabled: true,
        modifyVars: {
            '@primary-color': "#4777e8",
            '@link-color': '#4777e8',
        },

    }),

    addWebpackResolve({
        alias: {'@': path.resolve(__dirname, 'src')}
    }),


    addBabelPlugins(
        "@babel/plugin-syntax-object-rest-spread",
        ['@babel/plugin-proposal-decorators', {'legacy': true}]
    ),
    addBabelPresets([
        '@emotion/babel-preset-css-prop'
    ]),

    fixBabelImports('antd', {
        libraryName: 'antd',
        libraryDirectory: 'es',
        style: true,