-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
ReferenceError: React is not defined #9
Comments
You can adapt your const CracoSwcPlugin = require('craco-swc')
module.exports = {
plugins: [
{
plugin: CracoSwcPlugin,
options: {
swcLoaderOptions: {
jsc: {
transform: {
react: {
runtime: 'automatic',
},
},
},
},
},
},
],
} |
The proposed change in |
The proposed change in craco.config.js above does solve this error for me on the browser. const CracoSwcPlugin = require("craco-swc");
const jsc = {
parser: {
syntax: "typescript",
tsx: true,
dynamicImport: true,
},
transform: {
react: {
runtime: "automatic",
},
},
};
CracoSwcPlugin.overrideJestConfig = ({ jestConfig }) => {
const babelKey = Object.keys(jestConfig.transform)[0];
jestConfig.transform[babelKey] = [require.resolve("@swc/jest"), { jsc }];
return jestConfig;
};
module.exports = {
plugins: [
{
plugin: CracoSwcPlugin,
options: {
swcLoaderOptions: {
jsc,
},
},
},
],
}; |
This is now a default in 0.4.0 https://github.com/pradel/create-react-app-swc/releases/tag/craco-swc%400.4.0 |
Hi,
after switching to this tool as described in the manual in an existing project, I get the following error:
Anyways starting from a blank project works perfectly with this tool. Any idea what's happening?
The text was updated successfully, but these errors were encountered: