Issue 1:
Bug Report

I'm currently investigating blitz-js/babel-plugin-superjson-next#29.

It occurs since Next.js updated @babel/plugin-transform-react-jsx to 7.12.10.

TypeError: /[...]/babel-plugin-superjson-repro/pages/index.js: d(...) is not a function

It's caused by this code:

export function getServerSideProps() {
return {
props: {
date: new Date(),
},
};
}

export default function Home(props) {
return <div>hello world {props.date instanceof Date ? "true" : "false"}</div>;
}

After being passed through babel-plugin-superjson-next, it looks like this:

import { withSuperJSONPage as _withSuperJSONPage } from 'babel-plugin-superjson-next/tools';
import { withSuperJSONProps as _withSuperJSONProps } from 'babel-plugin-superjson-next/tools';

export const getServerSideProps = _withSuperJSONProps(
function getServerSideProps() {
return {
props: {
date: new Date(),
},
};
}
);

function Page({ products }) {
return <div>hello world {props.date instanceof Date ? "true" : "false"}</div>;
}

export default _withSuperJSONPage(Page);

Interestingly, the error does not occur if you move the export default onto it's own line: blitz-js/babel-plugin-superjson-next#29 (comment)

I would like to work on a fix! (provided you give me a hint in the right direction, and this is indeed a bug on Babel's side)

Current behavior

Repro: Skn0tt/babel-plugin-superjson-next-10.0.5-repro

(FYI: Since Next bundles Babel, linking a local Babel package for debugging won't work.)

Expected behavior

I expected it not to crash.

Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)

Next.js 10.0.5, babel-plugin-superjson-next.

Environment

Babel version(s): 7.12.10

Node/npm version: occurs on multiple versions

OS: occurs on multiple platforms

Monorepo: no

How you are using Babel: webpack / next

Additional context

I was able to track the error down to this line:

babel/packages/babel-plugin-transform-react-jsx/src/create-plugin.js

Line 277
in
6e9a174

const node = t.callExpression(get(pass, `id/${name}`)(), args);

In my case, name is "jsxs". So it tries to access id/jsxs from the plugin pass, which should have been defined here:

babel/packages/babel-plugin-transform-react-jsx/src/create-plugin.js

Line 205
in
6e9a174

define("id/jsxs", development ? "jsxDEV" : "jsxs");

Since this is in Program#enter, this should have run before, but it didn't.

I'm out of ideas and would very much appreciate your thoughts ☺️

Issue 2:
Bug Report

Hi there 👋 So from this morning around 08:30GMT we are seeing the following error when we try to compile our code with Rollup. Here is the stack trace that we are seeing.....

It looks to be able the same time you published an update to @babel/plugin-transform-react-jsx recently.

Here is the setup of Babel packages we are using.

"@babel/cli": "7.2.0",
"@babel/core": "7.2.0",
"@babel/eslint-parser": "^7.11.3",
"@babel/plugin-proposal-class-properties": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.6.0",
"@babel/plugin-transform-spread": "7.2.0",
"@babel/preset-env": "7.2.0",
"@babel/preset-react": "7.0.0",
"babel-core": "7.0.0-bridge.0",
"babel-loader": "8.0.4",
"babel-plugin-add-react-displayname": "0.0.5",
"babel-plugin-file-loader": "1.1.1",
"babel-plugin-inline-import-data-uri": "1.0.1",
"babel-plugin-inline-react-svg": "1.1.0",
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-transform-replace-object-assign": "^2.0.0",

Is there anything you suggest we should do instead?

Environment

Node/npm version: 10.15.3

OS: Windows

Monorepo: No

How you are using Babel: Rollup