Skip to content

Commit

Permalink
Revert "[examples] Update create-react-app examples with styled-compo…
Browse files Browse the repository at this point in the history
…nents to use package aliases (#27591)" (#27917)

This reverts commit 873e79c.
  • Loading branch information
mnajdova authored Aug 23, 2021
1 parent debba91 commit e108dbc
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ npm start

<!-- #default-branch-switch -->

Note that CodeSandbox is not supporting react-app-rewired, yet you can [still see the code](https://codesandbox.io/s/github/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components-typescript).

The following link leverages this demo: https://next.material-ui.com/guides/interoperability/#change-the-default-styled-engine with Parcel's alias feature within the `package.json`

[![Edit on CodeSandbox](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/styled-components-interoperability-w9z9d)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const { addWebpackAlias, override } = require('customize-cra');

module.exports = override(
addWebpackAlias({
'@material-ui/styled-engine': '@material-ui/styled-engine-sc',
}),
);
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"dependencies": {
"@material-ui/core": "next",
"@material-ui/lab": "next",
"@material-ui/styled-engine": "npm:@material-ui/styled-engine-sc@next",
"@material-ui/styled-engine-sc": "next",
"@testing-library/jest-dom": "latest",
"@testing-library/react": "latest",
"@testing-library/user-event": "latest",
Expand All @@ -14,15 +14,12 @@
"react-scripts": "latest",
"styled-components": "latest"
},
"resolutions": {
"@material-ui/styled-engine": "npm:@material-ui/styled-engine-sc@next"
},
"scripts": {
"tsc": "./node_modules/.bin/tsc",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test",
"eject": "react-app-rewired eject"
},
"browserslist": {
"production": [
Expand All @@ -41,6 +38,8 @@
"@types/react": "latest",
"@types/react-dom": "latest",
"@types/styled-components": "latest",
"customize-cra": "latest",
"react-app-rewired": "latest",
"typescript": "latest"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"skipLibCheck": true
"paths": {
"@material-ui/styled-engine": ["./node_modules/@material-ui/styled-engine-sc"]
}
},
"include": ["src/**/*"]
}
2 changes: 2 additions & 0 deletions examples/create-react-app-with-styled-components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ npm start

<!-- #default-branch-switch -->

Note that CodeSandbox is not supporting react-app-rewired, yet you can [still see the code](https://codesandbox.io/s/github/mui-org/material-ui/tree/next/examples/create-react-app-with-styled-components).

The following link leverages this demo: https://next.material-ui.com/guides/interoperability/#change-the-default-styled-engine with Parcel's alias feature within the `package.json`

[![Edit on CodeSandbox](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/styled-components-interoperability-w9z9d)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const { addWebpackAlias, override } = require('customize-cra');

module.exports = override(
addWebpackAlias({
'@material-ui/styled-engine': '@material-ui/styled-engine-sc',
}),
);
17 changes: 9 additions & 8 deletions examples/create-react-app-with-styled-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"dependencies": {
"@material-ui/core": "next",
"@material-ui/lab": "next",
"@material-ui/styled-engine": "npm:@material-ui/styled-engine-sc@next",
"@material-ui/styled-engine-sc": "next",
"@testing-library/jest-dom": "latest",
"@testing-library/react": "latest",
"@testing-library/user-event": "latest",
Expand All @@ -14,14 +14,11 @@
"react-scripts": "latest",
"styled-components": "latest"
},
"resolutions": {
"@material-ui/styled-engine": "npm:@material-ui/styled-engine-sc@next"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test",
"eject": "react-app-rewired eject"
},
"browserslist": {
"production": [
Expand All @@ -34,5 +31,9 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"customize-cra": "latest",
"react-app-rewired": "latest"
}
}

0 comments on commit e108dbc

Please sign in to comment.