Comments (18)
@srph It seems that this issue is related to #57
as well as #62. As soon as a new version is available which sould happen within the next hours this should solve your issue.
from babel-plugin-rewire.
Really, really thanks 💘 . Looking forward to it 😄
from babel-plugin-rewire.
@srph :). Could you please try the beta version 0.1.23-beta-3. And let me know if this fixes the issue for you?
from babel-plugin-rewire.
I got new errors:
Uncaught TypeError: Cannot assign to read only property '__GetDependency__' of [object Object]
from babel-plugin-rewire.
@srph . Thanks for testing. Could you please provide a toy example or a PR with the sample, such that i can reproduce your error and provide a fix.
from babel-plugin-rewire.
Hmm, weird. I got the error around these lines.
exports['default'] = _defaultExport;
exports.__GetDependency__ = _GetDependency__; // this one
exports.__get__ = _GetDependency__;
exports.__Rewire__ = _Rewire__;
exports.__set__ = _Rewire__;
exports.__ResetDependency__ = _ResetDependency__;
exports.__RewireAPI__ = _RewireAPI__;
from babel-plugin-rewire.
I'm hitting the original issue in this thread. I can try out any beta versions, or if @speedskater can describe the source of the issue in more detail, I might take a shot at a PR to fix the problem...
from babel-plugin-rewire.
@dmwyatt did 0.1.23-beta-3 solve your issue?
@srph is this the generated or is this your code?
from babel-plugin-rewire.
@speedskater It is the generated code, and it seems to be from this plugin.
Honestly, I can see hints, but no concrete idea because I haven't seen the internals. I apologize if I can't be much of a help 😞
from babel-plugin-rewire.
@srph thanks for the feedback. I am more interested in the original not in the generated source code. So if you could create a simple toy example which results in the error it would be perfect. This would help me to reproduce the error.
from babel-plugin-rewire.
Noted 👌 . I'll work on it. I'll report anything I find.
from babel-plugin-rewire.
@srph Thanks 👍
from babel-plugin-rewire.
I found out something. It'll be a little bit long, so hang on. Like I said, AFAICR, I'm using Webpack and Karma. I forgot to mention that I'm also using Sinon and Chai. I am intensively using Sinon.
This was my webpack config for finding all test files:
// build/tests/webpack.files.js
/**
* Setup context module
* http://webpack.github.io/docs/context.html
*/
var ctx = require.context('../../common/', true, /\.spec\.js$/);
ctx.keys().forEach(ctx);
Instead of running all tests, I made a dummy suite:
// build/tests/dummy.spec.js
describe('test', () => {
it('should not fail', () => {
expect(1).to.equal(1);
});
});
And change my webpack config (for resolving spec files):
// build/tests/webpack.files.js
var ctx = require.context('./', true, /\.spec\.js$/);
ctx.keys().forEach(ctx);
No error occured.
Like I said, I am intensively using Sinon. My first clue (although not concrete) is that this plugin is having issues with Sinon. But I have yet to prove this.
from babel-plugin-rewire.
I'm sending a demo in a few minutes. It seems that I was correct.
// x.js
var x = {
yolo: () => {
}
};
// dummy.spec.js
import x from './x';
describe('x', () => {
it('should be called', () => {
let sandbox = sinon.sandbox.create();
sandbox.stub(x, 'yolo'); // error occurs
// x.yolo();
// expect(x.yolo.called).to.be.true;
// sandbox.restore();
});
});
Edit: False positive.
from babel-plugin-rewire.
Aha, I think I found out. This makes the error:
export const 'hello' = 'world';
export default exports; // The error triggers whenever I uncomment this line
Edit: I don't think this is an issue of the library. Closing this one. Sorry about the commotion, @speedskater. Also, thanks 👌
from babel-plugin-rewire.
@speedskater Yes, 0.1.23-beta-3, does fix the issue for me.
from babel-plugin-rewire.
@srph thanks for testing. Could you provide the whole sample file which contains "export default exports;" I would like to analyze if this could be a an error in certain edge cases.
from babel-plugin-rewire.
You can just copy-paste it. My sample is as it is. It bugged with that exact sample :)
from babel-plugin-rewire.
Related Issues (20)
- Broken bundles after upgrade to 1.2.0 HOT 1
- Error with `babel/preset-typescript` HOT 4
- How can I enable this for one module only? HOT 1
- Simply including this breaks lots of things
- Not working with jest, Invalid variable access: _get__ HOT 6
- Thanks for a great plugin! I'd suggest adding dynamic import syntax to the readme! :) HOT 2
- Windows 10 and Ubuntu output different code HOT 2
- can not work with element-ui
- Webpack bundle size increases dramatically with rewire HOT 1
- babel/plugin-transform-typescript and rewire HOT 1
- Documentation clarification
- Documentation clarification
- Documentation clarification HOT 1
- rewire seems to break `import * as foo from 'module'` HOT 1
- property names as variable names don't work in babel-plugin-rewire
- __Rewire__ is not a function HOT 1
- babel-plugin-rewire does not work in a Typescript project HOT 5
- Maintenance Request, is this repo actively maintained?
- Any plan to port this plugin to SWC?
- Integration with CRACO HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from babel-plugin-rewire.