-
Notifications
You must be signed in to change notification settings - Fork 40
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
Babel options to use import instead of require (for rollup) #206
Comments
That's a good idea and thanks for the rollup example! |
I've just found out the problem is caused by After removing it & make some small quick fix on rollup, it works perfectly plugins: [
...,
replace({
[`var importedWrapper = require('react-imported-component/wrapper');`]: `import importedWrapper from 'react-imported-component/wrapper';`,
delimiters: ['', ''],
}),
] |
https://github.com/theKashey/react-imported-component/blob/master/src/babel/babel.ts#L59 still something to be updated from my side. |
Ah, other issues for rollup are:
// Quick fix
replace({
'(!!module).hot': 'false',
delimiters: ['', ''],
}),
|
😅 that something I cannot fix that easely from my side. Sounds like there are two options:
|
Currently I see that
react-imported-component/babel
injectsThe problem is that the generated code is not work correctly in esm built (with rollup):
The generated code
If I manually change the code above to
Then it works perfectly
I can submit a PR if it's a suitable solution
Reproduce repo
https://github.com/joehua87/imported-component-rollup
The text was updated successfully, but these errors were encountered: