Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 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'
}
}),
*/
/* eslint-disable global-require */
const { override, addPostcssPlugins, disableEsLint } = require('customize-cra');
module.exports = override(
disableEsLint(),
addPostcssPlugins([
require('postcss-preset-env')({
stage: 0,
features: {
'custom-media-queries': {
importFrom: [
{
customMedia: {
'--phonePortrait': '(width <= 414px)',
'--phoneLandscape':
'(width >= 415px) and (width <= 667px)',
'--tabletPortrait':
'(width >= 668px) and (width <= 768px)',
'--tabletLandscape':
'(width >= 769px) and (width <= 1024px)',
'--desktopS':
: undefined,
process.env.NODE_ENV === 'development'
? addWebpackPlugin(new ReactRefreshPlugin())
: undefined,
// Add support for transpiling local package imports
babelInclude([
path.resolve('src'),
path.resolve('../backend'),
path.resolve('../universal'),
]),
babelExclude([
path.resolve('../backend/node_modules'),
path.resolve('../universal/node_modules'),
]),
// Disable CRA lint in favour of project lint
disableEsLint(),
);
libraryName: 'antd',
libraryDirectory: 'es',
style: true,
}),
addLessLoader({
javascriptEnabled: true,
// modifyVars: { '@primary-color': '#1DA57A' },
localIdentName: "leng-[local]-[hash:base64:5]"
}),
// 依赖分布地图 --analyze
addBundleVisualizer({
"analyzerMode": "static",
"reportFilename": "report.html"
}, true),
// 禁用 EsLint
disableEsLint()
);
module.exports = (config, env) => {
config = override(disableEsLint(),
addBabelPlugin('styled-components'),
addBabelPlugin([
'inline-react-svg',
{
ignorePattern: 'desert'
}
]))(config, env);
config = rewireReactHotLoader(config, env);
return config;
};
const {
override,
addDecoratorsLegacy,
disableEsLint,
addBundleVisualizer,
addWebpackAlias,
adjustWorkbox,
addLessLoader,
fixBabelImports
} = require('customize-cra');
const path = require('path');
module.exports = override(
addDecoratorsLegacy(),
disableEsLint(),
addBundleVisualizer({}, true),
addWebpackAlias({
'@': path.resolve(__dirname, 'src'),
components: path.resolve(__dirname, 'src/components'),
assets: path.resolve(__dirname, 'src/assets')
}),
adjustWorkbox(wb =>
Object.assign(wb, {
skipWaiting: true,
exclude: (wb.exclude || []).concat('index.html')
})
),
fixBabelImports('import', {
libraryName: 'antd',
style: true
}),
const {
addDecoratorsLegacy,
disableEsLint,
override
} = require("customize-cra");
module.exports = override(
addDecoratorsLegacy(),
disableEsLint()
);
aliases[key] = _moduleAliases[key].replace('.', appRootPath)
})
const addLoadablePlugin = config => {
config.plugins.push(
new LoadablePlugin()
)
config.plugins[0].options.inject = false
return config
}
module.exports = override(
process.env.NODE_ENV === 'production' && addLoadablePlugin,
disableEsLint(),
...addBabelPlugins('transform-imports', '@loadable/babel-plugin', 'transform-react-remove-prop-types'),
addWebpackAlias({ ...aliases, 'lodash-es': 'lodash' }),
hasCustomConfigOverrides && require(appConfigOverrides)
)
const {
override,
addDecoratorsLegacy,
disableEsLint,
addBundleVisualizer,
addWebpackAlias,
adjustWorkbox,
addLessLoader,
fixBabelImports
} = require('customize-cra');
const path = require('path');
module.exports = override(
addDecoratorsLegacy(),
disableEsLint(),
process.env.BUNDLE_VISUALIZE === 1 && addBundleVisualizer(),
addWebpackAlias({
'@': path.resolve(__dirname, 'src'),
components: path.resolve(__dirname, 'src/components'),
assets: path.resolve(__dirname, 'src/assets')
}),
adjustWorkbox(wb =>
Object.assign(wb, {
skipWaiting: true,
exclude: (wb.exclude || []).concat('index.html')
})
),
fixBabelImports('import', {
libraryName: 'antd',
style: true
}),