Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@remotion/bundler: Add react/jsx-dev-runtime to webpack aliases + Update MDX docs #2664

Merged
merged 2 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/bundler/src/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ export const webpackConfig = ({
alias: {
// Only one version of react
'react/jsx-runtime': require.resolve('react/jsx-runtime'),
'react/jsx-dev-runtime': require.resolve('react/jsx-dev-runtime'),
react: require.resolve('react'),
'react-dom/client': shouldUseReactDomClient
? require.resolve('react-dom/client')
Expand Down
6 changes: 3 additions & 3 deletions packages/docs/docs/legacy-babel-loader.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@ values={[
<TabItem value="npm">

```bash
npm i mdx-loader babel-loader @babel/preset-env @babel/preset-react
npm i babel-loader @babel/preset-env @babel/preset-react
```

</TabItem>
<TabItem value="pnpm">

```bash
pnpm i mdx-loader babel-loader @babel/preset-env @babel/preset-react
pnpm i babel-loader @babel/preset-env @babel/preset-react
```

</TabItem>

<TabItem value="yarn">

```bash
yarn add mdx-loader babel-loader @babel/preset-env @babel/preset-react
yarn add babel-loader @babel/preset-env @babel/preset-react
```

</TabItem>
Expand Down
21 changes: 5 additions & 16 deletions packages/docs/docs/overwriting-webpack-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,22 +122,22 @@ values={[
<TabItem value="npm">

```bash
npm i mdx-loader babel-loader @babel/preset-env @babel/preset-react
npm i @mdx-js/loader @mdx-js/react
```

</TabItem>
<TabItem value="pnpm">

```bash
pnpm i mdx-loader babel-loader @babel/preset-env @babel/preset-react
pnpm i @mdx-js/loader @mdx-js/react
```

</TabItem>

<TabItem value="yarn">

```bash
yarn add mdx-loader babel-loader @babel/preset-env @babel/preset-react
yarn add @mdx-js/loader @mdx-js/react
```

</TabItem>
Expand All @@ -161,20 +161,9 @@ export const enableMdx: WebpackOverrideFn = (currentConfiguration) => {
test: /\.mdx?$/,
use: [
{
loader: "babel-loader",
options: {
presets: [
"@babel/preset-env",
[
"@babel/preset-react",
{
runtime: "automatic",
},
],
],
},
loader: "@mdx-js/loader",
options: {},
},
"mdx-loader",
],
},
],
Expand Down
7 changes: 2 additions & 5 deletions packages/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@
"render-transparent": "remotion render --image-format=png --pixel-format=yuva420p --codec=vp8 react-svg out/video.webm"
},
"dependencies": {
"@babel/plugin-syntax-jsx": "7.12.13",
"@babel/preset-env": "7.12.13",
"@babel/preset-react": "7.12.13",
"@mdx-js/react": "^1.6.21",
"@mdx-js/react": "^2.3.0",
"@mdx-js/loader": "^2.3.0",
"@react-three/drei": "9.79.4",
"@react-three/fiber": "8.13.5",
"@remotion/babel-loader": "workspace:*",
Expand Down Expand Up @@ -56,7 +54,6 @@
"@types/web": "0.0.78",
"babel-loader": "^8.2.2",
"lottie-web": "5.12.2",
"mdx-loader": "3.0.2",
"opentype.js": "^1.3.4",
"polished": "^4.0.5",
"prettier": "^2.7.1",
Expand Down
15 changes: 2 additions & 13 deletions packages/example/src/webpack-override.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,9 @@ export const webpackOverride: WebpackOverrideFn = (currentConfiguration) => {
test: /\.mdx?$/,
use: [
{
loader: 'babel-loader',
options: {
presets: [
'@babel/preset-env',
[
'@babel/preset-react',
{
runtime: 'automatic',
},
],
],
},
loader: '@mdx-js/loader',
options: {},
},
'mdx-loader',
],
},
],
Expand Down
Loading