Skip to content

Commit

Permalink
Fixed react-app-rewired configuration
Browse files Browse the repository at this point in the history
Deployment failed due to change in react-app-rewired - timarney/react-app-rewired#348
  • Loading branch information
dance2die committed Feb 17, 2019
1 parent 58ea785 commit 3c483af
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
37 changes: 26 additions & 11 deletions config-overrides.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
const { injectBabelPlugin } = require("react-app-rewired");
// https://github.com/timarney/react-app-rewired/issues/348#issuecomment-452199363
const { override, fixBabelImports, addLessLoader } = require("customize-cra");

/**
* {@link https://ant.design/docs/react/use-with-create-react-app#Use-babel-plugin-import|AntD-Use babel-plugin-import}
*/
module.exports = function override(config, env) {
config = injectBabelPlugin(
["import", { libraryName: "antd", libraryDirectory: "es", style: "css" }],
config
);
return config;
};
module.exports = override(
fixBabelImports("import", {
libraryName: "antd",
libraryDirectory: "es",
style: true // change importing css to less
}),
addLessLoader({
javascriptEnabled: true,
modifyVars: { "@primary-color": "#1DA57A" }
})
);

// const { injectBabelPlugin } = require("react-app-rewired");

// /**
// * {@link https://ant.design/docs/react/use-with-create-react-app#Use-babel-plugin-import|AntD-Use babel-plugin-import}
// */
// module.exports = function override(config, env) {
// config = injectBabelPlugin(
// ["import", { libraryName: "antd", libraryDirectory: "es", style: "css" }],
// config
// );
// return config;
// };
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"dependencies": {
"antd": "3.9.2",
"axios": "0.18.0",
"customize-cra": "0.2.11",
"prop-types": "15.7.2",
"react": "16.8.2",
"react-app-rewired": "2.1.0",
Expand Down

0 comments on commit 3c483af

Please sign in to comment.