react-stripe-elements
react-stripe-elements copied to clipboard
Error: [ElementName] is not exported by node_modules/react-stripe-elements/es/index.js
Summary
When trying to use rollup to bundle my application, I'm getting an Error: 'CardElement' is not exported by node_modules/react-stripe-elements/es/index.js error on several of my react-stripe-elements imports.
Other information
Version: 4.0.0 rollup-config:
import babelPlugin from "rollup-plugin-babel";
import resolvePlugin from "rollup-plugin-node-resolve";
export default {
input: "src/index.js",
output: [
{
file: "dist/index.esm.js",
sourcemap: true,
format: "esm",
},
],
plugins: [
resolvePlugin(),
babelPlugin({
presets: [
[
"@babel/preset-env",
{
loose: true,
shippedProposals: true,
targets: {
node: "current",
ie: 11,
firefox: 50,
chrome: 50,
},
exclude: [
"transform-typeof-symbol"
]
}
],
[
"@babel/preset-flow"
],
[
"@babel/preset-react"
],
],
plugins: [
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-proposal-class-properties",
]
}),
],
external: id => /\.scss$/.test(id) || ["react", "react-dom", "classnames"].indexOf(id) !== -1,
};
Rollup stack trace:
Error: 'CardElement' is not exported by node_modules/react-stripe-elements/es/index.js
at error (/project/node_modules/rollup/dist/rollup.js:9396:30)
at Module.error (/project/node_modules/rollup/dist/rollup.js:13333:9)
at handleMissingExport (/project/node_modules/rollup/dist/rollup.js:13255:21)
at Module.traceVariable (/project/node_modules/rollup/dist/rollup.js:13647:17)
at ModuleScope.findVariable (/project/node_modules/rollup/dist/rollup.js:12354:39)
at FunctionScope.findVariable (/project/node_modules/rollup/dist/rollup.js:2963:38)
at ChildScope.findVariable (/project/node_modules/rollup/dist/rollup.js:2963:38)
at FunctionScope.findVariable (/project/node_modules/rollup/dist/rollup.js:2963:38)
at ChildScope.findVariable (/project/node_modules/rollup/dist/rollup.js:2963:38)
at Identifier$1.bind (/project/node_modules/rollup/dist/rollup.js:8315:40)
@Poggen: Yikes, that's no good. I don't see an immediate cause and might not be able to dig much deeper today. In the mean time, I suspect it works if you use our already-compiled output rather than the ES modules version.
Closing this as this project has migrated to React Stripe.js. If you believe this is still important, please re-open it there.