(1) The es6.js code appends fileExtension even for import statements that already have a file extension. lit-html.js has imports like below that specify the .js extension:
import { defaultTemplateProcessor } from './lib/default-template-processor.js';
(2) Relative paths aren't working correctly. The ./ in the import statement above should be relative to the directory where lit-html.js is. Instead, it's evaluating relative to the directory where class.js is.
The
es6!
plugin can't loadlit-html
due to problems with relative paths and file extensions. To reproduce, do anadd the entry below to
paths
in index.html:and then modify demo/class.js to load
lit-html
:It fails trying to GET:
There are (at least) two problems here:
(1) The
es6.js
code appendsfileExtension
even forimport
statements that already have a file extension.lit-html.js
has imports like below that specify the.js
extension:As per the examples in https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import, putting the
.js
in theimport
statement is actually not an error.(2) Relative paths aren't working correctly. The
./
in theimport
statement above should be relative to the directory wherelit-html.js
is. Instead, it's evaluating relative to the directory whereclass.js
is.