-
Notifications
You must be signed in to change notification settings - Fork 35
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
Issue with paths of reloaded module #141
Comments
Apologies that I haven't been present. Have major deadlines for Friday. Will be pushing forwards next week. |
Just as a side note, this isn't critical issue. So far we've workarounded it by adding following script to "js:chokidar": "cd ./source/scripts && chokidar-socket-emitter", So, we just launching Not super elegant and slightly hacky, but works. |
Looking at this, I wonder is it related to the SystemJS Hot Reloader, or Cockidar Socket Emitter itself... It seems like Socket Emitter |
Aha, actually Socket Emitter has hidden in code option So this does the trick: chokidarEventEmitter({ path: 'source/scripts', relativeTo: 'source/scripts' }, () => {
console.log('running')
}) It will force Emitter to watch only Not obvious, but works. |
Hi again, does this fix your issue? |
For me — yes. I didn't close the issue only because I wasn't sure is it a right solution in terms of API clearness. |
Yeah, path issues are not really the concern of this lib I think. We (and the browser) work from a top level url. If thats going to be customized a bit its the job of the developer (or the build server - i.e. the event emitter) to make sure that all plays well. If you're happy to close this I'll leave it in your hands :) |
Totally agree.
YEY! :D |
Hi @alexisvincent!
Sorry for bothering you again, but we have some troubles. Again.
I'm not sure that it is
systemjs-hot-reloader
issue, and maybe it is more related to configuration of JSPM. Though, I'm not sure.We have following file structure, which you can see here.
Just to be more clear, we have
Well, you can see here a bit tricky situation, when
jspm_packages
andmain.js
located outside of directory, which actually served. This isn't a problem for production, since on production JSPM just builds single file intobuild/assets/scripts/main.js
, thenindex.html
loads it and everyone happy and so on.But gets trickier in development environment, since we want to load sources directly, without building or copying them.
To do this, we're providing for Browser Sync some additional routes, to make certain directories be available under specific urls
This is quite straightforward. Now
will work, even despite it located outside of served directory. Not a problem.
But next part is quite tricky, and maybe it is where I messing something wrong, so that
systemjs-hot-reloader
receives wrong path. I tried different approaches, but all of them ended in quite same situation.The esiest way for me was to route
/assets/scripts
to point to/source/scripts
:Now I can write in my
jspm.config.js
specificbaseUrl
for browser:And it will properly import
main.js
in html:Everything works fine. But if I will edit any
js
file and save it, hot-reloading won't kick-in.Here what shows debugger:
Ass you can see, it appends to
baseUrl
full path from root (where chokidar has been launched) tobaseUrl
, thus we're receiving wrong path:while expected one is
So far the only solution I was able to figure out is to change
baseUrl
to/
, and loadmain.js
in html by providing following path:This isn't bad, but feels somehow wrong and less elegant, since it is preferable to minimize amount of paths declarations.
Maybe there are better ways?
If it isn't systemjs-hot-reloader issue, than I'm sorry for posting it here.
The text was updated successfully, but these errors were encountered: