Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Import module issue with HMR #541

Closed
wclr opened this issue May 17, 2017 · 44 comments
Closed

Import module issue with HMR #541

wclr opened this issue May 17, 2017 · 44 comments

Comments

@wclr
Copy link

wclr commented May 17, 2017

fuse-box 2.0.0
The issue can be reproduced with the repo https://github.com/whitecolor/fuse-box-xstream

TypeError: Cannot read property 'default' of undefined
@devmondo
Copy link
Member

devmondo commented May 17, 2017

@whitecolor
just cloned your repo and everything works fine, just make sure you do the following

  • install xtream and loadash deps from npm
  • install the latest fuse beta npm install fuse-box@^2.1.0-beta.2 ( not required, just to make sure)
  • clear .fusebox cache folder
  • node fuse.js (after you compile fuse.ts , as you did it with typescript)

here is a picture to show you how it is running fine
image

@devmondo
Copy link
Member

will close this for now, let us know otherwise :)

@wclr
Copy link
Author

wclr commented May 17, 2017

See this is my flow with this repo:
fuse-box-xstream-issue

And I have the same experience with other project and such imports.

Notice that you should first uncomment first two lines reload, and then the rest two lines.

@devmondo
Copy link
Member

something is weird, it is really working, I tried npm install and not yarn, maybe yarn is the issue?

@devmondo devmondo reopened this May 17, 2017
@wclr
Copy link
Author

wclr commented May 17, 2017

Not sure how it can even be related. But I removed node_modules and made npm install - the same result.

something is weird, it is really working,

Did you follow the flow described: Load page, first uncomment first two lines (debounce), reload should occur, and then uncomment the rest two lines (throttle)?

@devmondo
Copy link
Member

please, nuke your node_modules folder, fuse cache folder and build folder, start fresh.

I assure you that i followed something is really off! try to nuke everything, including your build folder!

@wclr
Copy link
Author

wclr commented May 17, 2017

Well I do this, the same result, maybe someone else will try? I'm doing this on Windows, though not sure why it should really matter for this case.

@devmondo
Copy link
Member

@whitecolor, i am on windows too!

@Ebuall
Copy link

Ebuall commented May 17, 2017

Having exactly the same on linux
screenshot_20170517_214023

@nchanged
Copy link
Contributor

Ok, when you first load the page, your bundle doesn't contain the target library. On an HMR you are getting an error, and fusebox is trying to reload the page cuz the module wasn't loaded at all. My assumption is that something wrong happens in between.

Does it work for you if you bundle with uncommented section of your code, and keep working?

@wclr
Copy link
Author

wclr commented May 17, 2017

Does it work for you if you bundle with uncommented section of your code, and keep working?

Yes of course it works, check the repo yourself.

@nchanged
Copy link
Contributor

Well I don't have any problem there, whatsoever ;-) like @devmondo
NodeJs version?

@wclr
Copy link
Author

wclr commented May 17, 2017

v6.10.2

@devmondo
Copy link
Member

could you update to latest node please and see

@aretecode
Copy link
Contributor

I tried

setup

result

  • worked for hmr
  • had no errors

@wclr
Copy link
Author

wclr commented May 18, 2017

I'm installed latest stable 6.10.3, the same result.

@wclr
Copy link
Author

wclr commented May 18, 2017

I've added watch via docker and latest node image, it should use more immutable environment, please try it, see changed instructions in readme.

@devmondo
Copy link
Member

@whitecolor, I really think this is some OS related or hardware issue on your side. This is crazy as per above you can see that 3 different people on 3 different OSes and machines cloned and tried your repo, and there was no issue.

@nchanged is there anything else possible we are missing, you might think of here?

@wclr
Copy link
Author

wclr commented May 18, 2017

@devmondo did you try docker version?

@nchanged
Copy link
Contributor

I just tried it.
tesss

No success;-( i mean failure.

@wclr
Copy link
Author

wclr commented May 18, 2017

@nchanged
try just to uncomment last two lines, first two should not be commented when running first time, follow steps in updated readme.

@nchanged
Copy link
Contributor

No matter how I tried, I cannot reproduce the issue

sss222

@wclr
Copy link
Author

wclr commented May 18, 2017

This his still a heisenbug I too sometimes have no error.
fuse-box-xstream-issue-docker

@nchanged
Copy link
Contributor

Could it be related to how fast you click save?

@wclr
Copy link
Author

wclr commented May 18, 2017

I just save one time when I uncomment. It probably can relate to that change event is firing multiple times or something and fuse-box doesn't handle it well. Need to debug.

@devmondo
Copy link
Member

i think i know the issue, it is race condition, it happened to me with webstorm, try to open your project in notepad and not in VS code and see if this helps

@wclr
Copy link
Author

wclr commented May 18, 2017

I tried with nodepad++ (notepad doesn't hanldle well LF line endings). Error is still here. And I see nothing wrong with handling events https://github.com/fuse-box/fuse-box/blob/master/src/core/BundleProducer.ts#L98 there is no any racing events.

@devmondo
Copy link
Member

man! your case is crazy, can you try it on another machine( real not VM)

@wclr
Copy link
Author

wclr commented May 18, 2017

We tried (two different people) and get the error on two different machines windows and linux. I'm not sure why don't get the error. In some case it is still should occur. I will try to provide better example or debug myself.

@nchanged
Copy link
Contributor

@whitecolor I believe that can happen. We have been struggling for a very long to get it to the state where it is now, but it's not perfect. Let me know if can help debugging it.

@xdave
Copy link

xdave commented May 20, 2017

Happens to me, too (linux, vscode)

@arabsight
Copy link
Contributor

I'm getting the error too (linux, node 7.10)

@aretecode
Copy link
Contributor

so windows & mac work, linux seems to have an issue...

@wclr
Copy link
Author

wclr commented May 21, 2017

I'm getting this on Windows too, you may see on my comment

@nchanged
Copy link
Contributor

You guys ... is it a blocker? :)

@xdave
Copy link

xdave commented May 21, 2017

Nope. Tree-shaking is more important. :)

@nchanged
Copy link
Contributor

Good cuz I rather focus on a feature I am working ATM, it's quite an important one, and yes tree shaking is coming soon

@devmondo
Copy link
Member

out of interest, those of you who are facing this issue, do you have SSD drives or normal drives?

@wclr
Copy link
Author

wclr commented May 21, 2017

You guys ... is it a blocker? :)

Just an annoying bug.

out of interest, those of you who are facing this issue, do you have SSD drives or normal drives?

SSD drives, Docker on windows uses SMB protocol

There is seem to be something wrong with a logic of injecting new dependencies, not platform specifics.

@nchanged
Copy link
Contributor

@whitecolor Does fuse refresh the page automatically? (Cuz it should if a package is not found)

@devmondo
Copy link
Member

@nchanged could it be polling issue? should we test it with chokidar polling option?

@xdave
Copy link

xdave commented May 21, 2017

Normal drive here. Haven't tested on my laptop SSD.

@devmondo
Copy link
Member

guys could you upgrade to latest beta we enabled passing options to chokidar http://fuse-box.org/page/development#chokidar-options

let us know please :)

@devmondo
Copy link
Member

this should be working now with the latest version.

we will close this for now but let us know otherwise :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants