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

Error: 'ReactComponent' is not exported when babel is set to false #701

Open
ShivamS136 opened this issue Mar 23, 2022 · 3 comments
Open

Comments

@ShivamS136
Copy link

ShivamS136 commented Mar 23, 2022

I am using SVGR with rollup and I want to use namedExport only. Everything works fine but when I add option babel:false then I get below error:

[!] Error: 'ReactComponent' is not exported by src/lib/components/textInput/PhoneDial.svg, imported by src/lib/components/textInput/TextInput.jsx

My rollup config is below:

import babel from "@rollup/plugin-babel";
import commonjs from "@rollup/plugin-commonjs";
import external from "rollup-plugin-peer-deps-external";
import postcss from "rollup-plugin-postcss";
import resolve from "@rollup/plugin-node-resolve";
import image from "@rollup/plugin-image";
import pkg from "./package.json";
import svgr from "@svgr/rollup";

const config = {
	input: "./src/lib/index.js",
	output: [
		{
			file: pkg.main,
			format: "cjs",
			exports: "named",
		},
		{
			file: pkg.module,
			format: "esm",
			exports: "named",
		},
	],
	plugins: [
		external(),
		resolve({ extensions: [".js", ".jsx", ".json"] }),
		commonjs(),
		babel({
			exclude: "node_modules/**",
			presets: ["@babel/preset-env", "@babel/preset-react"],
		}),
		postcss({ modules: true }),
		image(),
		svgr({ exportType: "named", babel: false }),
	],
};

export default config;
@stale
Copy link

stale bot commented Jun 19, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jun 19, 2022
@stale
Copy link

stale bot commented Oct 1, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Oct 1, 2022
@stale stale bot closed this as completed Oct 16, 2022
@gregberge gregberge reopened this Oct 17, 2022
@stale stale bot removed the wontfix label Oct 17, 2022
@stale
Copy link

stale bot commented May 21, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label May 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants