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) {
config = injectBabelPlugin("babel-plugin-styled-components", config);
config = rewireMobX(config, env);
config.module.rules.push({
test: /\.worker\.jsx$/,
use: [
{ loader: 'worker-loader' },
{ loader: 'babel-loader' }
]
})
/*
// If we want to apply the babel loader to some node module...
config = rewireBabelLoader.include(
config,
resolveApp("node_modules/")
);
*/
module.exports = function override(config, env) {
config = injectBabelPlugin(
["import", { libraryName: "antd", style: true, libraryDirectory: "es" }],
config,
);
if (env === "production") {
// Remove default polyfills
config.entry = { main: paths.appIndexJs };
// Change css module class names in production
const cssLoader = getLoader(
config.module.rules,
rule => String(rule.test) === String(/\.module\.css$/),
).loader.find(loader => loaderNameMatches(loader, "css-loader"));
cssLoader.options.localIdentName = "ma-[hash:base64:8]";
// Include bundle analyzation
if (env === 'development') {
config = injectBabelPlugin(['dva-hmr'], config);
} else {
// 替换uglify为uglify-es否则,build时会出错
config = removeWebpackPlugins(config, env, {
pluginNames: ['UglifyJsPlugin']
});
config.plugins = (config.plugins || []).concat([
new ParallelUglifyPlugin({
uglifyES: {}
})
]);
}
config = injectBabelPlugin('transform-decorators-legacy', config);
config = injectBabelPlugin(
['import', { libraryName: 'antd', style: true }],
config
);
config.externals = {};
return rewireLess.withLoaderOptions(
`${env === 'production' ? 'app' : '[local]'}-[hash:base64:8]`,
{
modifyVars: {}
}
)(config, env);
};
module.exports = function override(config, env) {
// do stuff with the webpack config...
config.output.publicPath = './';
config = injectBabelPlugin(['import', { libraryName: 'antd', style: true }], config);
config = injectBabelPlugin(['wrapper', {}], config);
config = rewireLess.withLoaderOptions({
modifyVars: { '@primary-color': '#1DA57A' },
javascriptEnabled: true,
})(config, env);
return config;
};
module.exports = function override(config, env) {
config = injectBabelPlugin(
[
'flow-runtime',
{
assert: true,
annotate: true,
},
],
config,
);
if (env === 'production') {
console.log('⚡ Production build with optimization ⚡');
config = injectBabelPlugin('closure-elimination', config);
config = injectBabelPlugin('transform-react-inline-elements', config);
config = injectBabelPlugin('transform-react-constant-elements', config);
}
function rewireMobX(config, env) {
return injectBabelPlugin('transform-decorators-legacy', config);
}
module.exports = function override(config, env) {
config = injectBabelPlugin(['import', { libraryName: 'antd', style: true }], config);
config = rewireLess.withLoaderOptions({
javascriptEnabled: true,
modifyVars: { "@primary-color": "#FFA940" },
})(config, env);
return config;
};
module.exports = function override(config, env) {
config = injectBabelPlugin(
['import', { libraryName: 'antd', style: true }],
config
);
config = rewireCssModules(config, env);
config = rewireLess.withLoaderOptions({
modifyVars: {
'@primary-color': '#00BFFF',
'@input-height-base': '40px',
'@btn-height-base': '40px'
}
})(config, env);
return config;
};
module.exports = function override(config, env) {
config = injectBabelPlugin(['import', {libraryName: 'antd', libraryDirectory: 'es', style: 'css'}], config);
if ('production' === env) config.devtool = 'none';
return config;
};
module.exports = function override(config, env) {
config = injectBabelPlugin(['import', { libraryName: 'antd', style: true }], config)
config = rewireLess.withLoaderOptions({
modifyVars: themeVariables
})(config, env)
return config
}