Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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'
}
}),
*/
addBabelPlugin([
'@babel/plugin-proposal-class-properties',
// public 目录
path.resolve(path.dirname(process.cwd()), 'public', 'src')
]),
// 按需加载
fixBabelImports('import', {
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()
);
const path = require("path");
const {
override,
addWebpackAlias,
addBabelPlugins,
addBundleVisualizer
} = require("customize-cra");
module.exports = {
webpack: override(
addWebpackAlias({
"#": path.resolve(__dirname, "./src"),
"react-dom": "@hot-loader/react-dom"
}),
addBundleVisualizer({}, true),
...addBabelPlugins("emotion", "react-hot-loader/babel")
),
jest: config => ({
...config,
setupFilesAfterEnv: ["/.jest/setup.js"],
moduleNameMapper: { "#(.*)$": "/src/$1" },
coverageDirectory: "/.coverage"
})
};
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
}),
addLessLoader({
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
}),
addLessLoader({