Skip to content
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

Problems with requireJS urls when project not in the root directory #325

Open
gaplyk opened this issue Nov 19, 2013 · 7 comments
Open

Problems with requireJS urls when project not in the root directory #325

gaplyk opened this issue Nov 19, 2013 · 7 comments

Comments

@gaplyk
Copy link

gaplyk commented Nov 19, 2013

When you trying to place index.html and the project to the subdirectory on the server and change path's in config file, it couldn't find some files and templates.

you can try to do this with a calendar app.

@VirtueMe
Copy link
Contributor

The whole path resolution thing is in my understanding not working correctly in the Components manager right now.

I'm working on a PR that tries to do the path resolution in a better manner. The key thing is to understand how the inner workings of requirejs path resolution is. Right now Aurajs use the CommonJs pattern for components starting. The layout pattern for the component templates is fine enough, but there are some errors in path resolution as of my findings and the tests I've done. The key approach for me is to understand what Aurajs/arura are trying to achieve when it's setting up the sandboxes. I don't want to break the sandbox handling in my PR.

@sbellity
Copy link
Member

@gaplyk @VirtueMe Not sure I understand what the issue is. Can you provide an example to reproduce it ?

@VirtueMe
Copy link
Contributor

Aurajs defaults to relative paths, and in my cases this seems not to be the best approach. It works fine inside a CommonJS package, but creates some tension in my aurajs app space. I might be on thin ice, but it has been my experience with my minified aurajs app that you plug into pages on other domains.

@gaplyk
Copy link
Author

gaplyk commented Nov 20, 2013

Unfortunately i can't share the code of project where I faced with this problem. I'll try to describe:
When you have relative path's to the modules requirejs you need always to define extension of files. look on core.js
line 298.
after I had add '.js' to 'main' (i really didn't want to do this) aura finally start to found all modules entries.

this happen because my index.html and another files placed to the subdirectory, and executing path for example is:
http://localhost:8080/AuraSample/index.html

Try to place calendar app in such directories and play with variables relative and baseUrl in config.

@VirtueMe
Copy link
Contributor

@gaplyk , I have made a version I'm testing in my environment. I feel this gives me more control and follows requirejs recommendations better. If you want you can give it a test run. I have made a develop branch in my fork of the repository, you can fetch it here: Virtueme/develop

@marlongichie
Copy link

@VirtueMe Came across this issue today in one of my projects that uses aurajs. Did you manage to find a solid solution?

@VirtueMe
Copy link
Contributor

I think my fork/branch works better, but it's not optimal. It has been in production for a couple of weeks now. It has been some crazy weeks, so I haven't had the time to give Aura and other projects I like the attention they deserve the last month.

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

No branches or pull requests

4 participants