Skip to content
This repository has been archived by the owner on Jul 13, 2020. It is now read-only.

Fetch a file outside of page's directory #100

Closed
amatiasq opened this issue Mar 5, 2014 · 4 comments
Closed

Fetch a file outside of page's directory #100

amatiasq opened this issue Mar 5, 2014 · 4 comments

Comments

@amatiasq
Copy link

amatiasq commented Mar 5, 2014

My directory structure is

project/
  demo/
    index.html
    demo.js
  src/
    my-file.js

demo.js

import "../src/my-file.js"

index.html

<!DOCTYPE html>
<html>
  <head>
    <title>test Test</title>
  </head>
  <body>
    <script src="traceur.js"></script>
    <script src="es6-module-loader.js"></script>
    <script>System.import('./demo');</script>
  </body>
</html>

It loads demo.js, but when System.normalize is invoked with

"../src/my-file" "./demo" "http://localhost/project/test/demo.js"

It returns src/my-file (note the lack of ..) of course this evaluates to http://localhost/project/test/src/my-file.js produces 404.

If I move index.html to project folder it works perfectly. I can't understand what's happening, maybe .. is ignored after the page's root?

@guybedford
Copy link
Member

The spec in its current form does not permit backtracking below the baseURL. This polyfill strictly follows the spec. There is a spec issue for this here - jorendorff/js-loaders#76.

Please comment on this to add your use case and help change the spec!

@guybedford
Copy link
Member

If we do include a fix for this, it would be added to the SystemJS project - systemjs/systemjs#50

@amatiasq
Copy link
Author

amatiasq commented Mar 5, 2014

Thanks, I'll patch System.normalize for now until it's done ;)

@guybedford
Copy link
Member

Sure, that would be the way to do it! If you feel like submitting a PR to the SystemJS core.js, that would be welcome too!

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

No branches or pull requests

2 participants