Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 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',
},
}),
);
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')
]),
// 按需加载
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'
}
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',
},
}),
);
// 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' },
/* 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
},
}),
);
const { addBabelPlugins, override, useEslintRc } = require('customize-cra');
module.exports = override(
...addBabelPlugins(
[
'import',
{
libraryName: 'antd',
libraryDirectory: 'es',
style: 'css',
},
],
['lodash', { id: ['lodash'] }]
),
useEslintRc()
);
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',
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',