alexisvincent / systemjs-hot-reloader

reloads your modules as needed so that you can have satisfyingly fast feedback loop when developing your app
MIT License
228 stars 36 forks source link

JSPM Bundle not right with systemjs-hot-reloader #130

Closed NickPadilla closed 7 years ago

NickPadilla commented 7 years ago

Hello!

Great work on this project, thanks a heap! When i am doing a jspm bundle base app/base-bundle.js --inject --minify and i try running that build using the original index.html - i get this error in the console.

GET http://localhost:8000/systemjs-hot-reloader 404 (File not found) N @ fetch.js:32 (anonymous) @ instantiate.js:165

I am just running this using python -m SimpleHTTPServer.

I was under the impression that systemjs-hot-reloader would get written out during the build, or just providing a stub implementation. If i try to add ta map field in the jspm.browser.js to not load systemjs-hot-reloader then i get an error that connect() is not a function.

Is there a way to tell the JSPM build to build for production, thought it was the default, so that i don't have to really edit my index.html for production?

alexisvincent commented 7 years ago

@NickPadilla Since systemjs-hot-reloader is never imported by your app, it doesn't get added to the bundle (which is traced from base). To solve just include systemjs-hot-reloader in your bundle. Something like jspm bundle base + systemjs-hot-reloader app/base-bundle.js --inject --minify

alexisvincent commented 7 years ago

Closing, if still not working feel free to reopen :)

cristhian-net commented 7 years ago

@alexisvincent I'm having this problem. I tried with your code without success, because it only bundle to a single file. I'm using v1.1.0. I don't want to modify my code for production either. Any advice? Thanks

alexisvincent commented 7 years ago

It's suppose to bundle to a single file though?

cristhian-net commented 7 years ago

Sorry I just read this today. I thought that this command jspm bundle base + systemjs-hot-reloader app/base-bundle.js --inject --minify will bring the hot-reloader to the bundle (and I think it will do it), but then when this line is called SystemJS.import('systemjs-hot-reloader'), I think that is looking for it outside the bundle because I get GET http://localhost:8000/systemjs-hot-reloader 404 (File not found). But commenting the line importing hot-reloader will make the app work. Sorry if this is not an issue for this package but I found it searching for help with production bundle including systemjs-hot-reloader

alexisvincent commented 7 years ago

Hmm, weird. If you do a string search inside your bundle, can you see the systemjs-hot-reloader library? Are you loading the JSPM config? Sorry this took so long, under a lot of work pressure.

cristhian-net commented 7 years ago

No problem, we are working with the workaround for the time being. I can see the following:

Main\app-bundle.js systemjs-hot-reloader1

Main\DefaultTabs.aspx systemjs-hot-reloader2

Chrome DevTools systemjs-hot-reloader3

jspm.config.js systemjs-hot-reloader4

alexisvincent commented 7 years ago

Is systems-hot-reloader/dist/index.js being injected into the bundle?

I wonder if you aren't perhaps bundling in production mode and then loading it in development mode. Can you try set both to dev?