-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade react, tailwindcss etc. and replace mdx.macro with @mdx-js/lo…
…ader For mdx we need to reintroduce craco because of a bug in CRA 5 (see facebook/create-react-app#12166 and https://mdxjs.com/docs/getting-started/#create-react-app-cra). Also we need to add @babel/core for lingui to work.
- Loading branch information
Showing
10 changed files
with
2,029 additions
and
4,206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["babel-preset-react-app"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const {addAfterLoader, loaderByName} = require('@craco/craco') | ||
|
||
module.exports = { | ||
webpack: { | ||
configure(webpackConfig) { | ||
addAfterLoader(webpackConfig, loaderByName('babel-loader'), { | ||
test: /\.mdx?$/, | ||
loader: require.resolve('@mdx-js/loader') | ||
}) | ||
return webpackConfig | ||
} | ||
}, | ||
style: { | ||
postcssOptions: { | ||
plugins: [ | ||
require('tailwindcss'), | ||
require('autoprefixer'), | ||
], | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,15 @@ | ||
import React, {lazy, Suspense} from 'react'; | ||
import React from 'react'; | ||
import {Helmet} from 'react-helmet-async'; | ||
import {Trans, t} from '@lingui/macro'; | ||
import {importMDX} from 'mdx.macro'; | ||
|
||
const Content = lazy(() => importMDX('../about.mdx')); | ||
import {t} from '@lingui/macro'; | ||
import Content from '../about.mdx'; | ||
|
||
export default function About () { | ||
return ( | ||
<div className="page p-4 markdown max-w-screen-lg"> | ||
<Helmet> | ||
<title>Einakter: {t`About`}</title> | ||
</Helmet> | ||
<Suspense fallback={<div><Trans>Loading...</Trans></div>}> | ||
<Content/> | ||
</Suspense> | ||
<Content/> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,27 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import ReactDOM from 'react-dom/client'; | ||
import {HelmetProvider} from 'react-helmet-async'; | ||
import { I18nProvider } from '@lingui/react'; | ||
import i18n from './i18n'; | ||
import App from './App'; | ||
import * as serviceWorker from './serviceWorker'; | ||
import reportWebVitals from './reportWebVitals'; | ||
|
||
import './index.css'; | ||
|
||
ReactDOM.render( | ||
const root = ReactDOM.createRoot( | ||
document.getElementById('root') as HTMLElement | ||
); | ||
root.render( | ||
<React.StrictMode> | ||
<I18nProvider i18n={i18n}> | ||
<HelmetProvider> | ||
<App /> | ||
</HelmetProvider> | ||
</I18nProvider> | ||
</React.StrictMode>, | ||
document.getElementById('root') | ||
</React.StrictMode> | ||
); | ||
|
||
// If you want your app to work offline and load faster, you can change | ||
// unregister() to register() below. Note this comes with some pitfalls. | ||
// Learn more about service workers: https://bit.ly/CRA-PWA | ||
serviceWorker.unregister(); | ||
// If you want to start measuring performance in your app, pass a function | ||
// to log results (for example: reportWebVitals(console.log)) | ||
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals | ||
reportWebVitals(); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { ReportHandler } from 'web-vitals'; | ||
|
||
const reportWebVitals = (onPerfEntry?: ReportHandler) => { | ||
if (onPerfEntry && onPerfEntry instanceof Function) { | ||
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { | ||
getCLS(onPerfEntry); | ||
getFID(onPerfEntry); | ||
getFCP(onPerfEntry); | ||
getLCP(onPerfEntry); | ||
getTTFB(onPerfEntry); | ||
}); | ||
} | ||
}; | ||
|
||
export default reportWebVitals; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.