Skip to content

path and file extension errors loading lit-html #34

@wkeese

Description

@wkeese

The es6! plugin can't load lit-html due to problems with relative paths and file extensions. To reproduce, do an

npm install lit-html

add the entry below to paths in index.html:

'lit-html': '../node_modules/lit-html/lit-html',

and then modify demo/class.js to load lit-html:

import {html, render} from 'lit-html';

It fails trying to GET:

requirejs-babel/demo/lib/default-template-processor.js.js 

There are (at least) two problems here:

(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';

As per the examples in https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import, putting the .js in the import statement is actually not an error.

(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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions