Open mfrachet opened 8 years ago
@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 Uncaught TypeError: Cannot redefine property: __get__
with Karma and Webpack.
but only when Karma points to a single file which requires all other test files:
const tests = require.context('.', true, /\.test\.js$/); tests.keys().forEach(tests);
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 https://github.com/eventlistener/babel-plugin-rewire-issue-144/pull/1.
It's a subtle issue where the following conditions need to be met in order to reproduce it:
export * from ...
The re-exporting module can be located anywhere, including node_modules
. Whether or not any methods provided by the plugin are used at all doesn't matter either.
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 babel.config.js
looking like:
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 ?