-
Notifications
You must be signed in to change notification settings - Fork 90
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
Cannot redefine property: __Rewire__ after build #144
Comments
@Skahrz thanks for reporting the issue. I will have a look at the problem on monday. Would it be possible tfor you o create a PR with a failing sample in the mean time? |
@Skahrz sorry for the long delay, in tackling your issue. Do you have more details on how to reproduce it (or is it already fixed in 1.0.0 ?) |
Not sure if it's related but I'm getting but only when Karma points to a single file which requires all other test files: If Karma is setup to find and process all test files (without the require.context) it works. |
I managed to make a minimal reproducible example, see eventlistener/babel-plugin-rewire-issue-144#1. It's a subtle issue where the following conditions need to be met in order to reproduce it:
The re-exporting module can be located anywhere, including |
any update on this issue? I'm quite stuck right now, and I don't really know how to workaround this issue 😕 |
is there a way to prevent this plugin to apply to a dependency? In my case, I know which dependency is triggering the issue, and I don't need to apply rewire to it. Is there a way, either as a plugin argument, or directly into babel to prevent rewire to apply on this specific dep? |
to answer my own question, I ended up having a module.exports = {
env: {},
overrides: [
{
include: (filename) => filename.indexOf("/node_modules/") !== -1,
env: {
test: {
plugins: ["@babel/plugin-transform-modules-commonjs"],
},
},
},
{
exclude: (filename) => filename.indexOf("/node_modules/") !== -1,
env: {
test: {
plugins: [
"rewire",
"@babel/plugin-transform-modules-commonjs",
],
},
},
},
],
}; Hope it helps |
I m using this library to make rewire inside of a project and I m having some troubles while requiring the due module in another one.
My module is the following : https://github.com/Skahrz/express-konnector
I try to use the express-konnector (locally) from that little script called index.js :
And when I try to run the script using :
I have the following error that is thrown :
I m using (for building the lib) :
my .babel.rc :
Any idea of how to correct it ?
The text was updated successfully, but these errors were encountered: