Fix for extension problem (es6 trying to load foo.js.js) and relative path problem.#35
Fix for extension problem (es6 trying to load foo.js.js) and relative path problem.#35wkeese wants to merge 2 commits intomikach:masterfrom
Conversation
and that relative paths within the original example work correctly. You probably don't want to commit this to the repository, or maybe want to commit it as another demo/test. Also, note that I couldn't support a path for lit-html of 'lit-html': '../node_modules/lit-html/lit-html' because then there's no way to specify the path to lit-html's support files (i.e. the other files in the lit-html/ directory). So instead I did: 'lit-html': '../node_modules/lit-html'
|
The RequireJS does not allow appending Loading |
|
OK, thanks for looking at it.
OK, my fix does work for my test case (you can confirm it from my branch), but your fix in 8f93a0e looks like it works too (although I prefer more concise code like
OK. I'm unclear how your example is working given that you define the path to lit-html as which presumably points to which somehow loads Having said that, I can't reproduce the relative path problem I saw a few years ago, so I guess |
|
PS: Oh, your demo is using lit-html 2.0.2 whereas my test file is using lit-html 1.1.2. In lit-html 2.0.2, lit-html.js is self-contained, it doesn't do a etc. So, your demo isn't even testing relative paths like that. |
Here are some proposed changes for
es6.jsto be able to load lit-html (and other problematic modules). The rest of the changed files are just for testing and don't necessarily need to be checked in.The problem I saw was with loading lit-html.js via an absolute path, and then lit-html.js tried to load files relative to itself via relative paths like "./lib/default-template-processor.js".
The first issue is that es6 appends ".js" even though the path already has an extension. So that's a trivial one-line fix.
The second problem is to fix relative paths. es6 was interpreting the relative path above to be relative to the original module, or something like that. I updated resolvePath() so it interprets it relative to the file doing the import.
I tested on chrome and IE11. Didn't try a build though, since we aren't using r.js for builds anymore.
Fixes #34.