This might be down at the compiler level.
When I attempt to load a module that exports a value as default, the compiler assumes it's a component and attempts to load the corresponding html file.
// foo.js
function foo () {
return "foo";
}
export default foo;
// bar.js
import foo from 'foo.js'
foo.html doesn't exist. I should be able to import foo without any errors.
Error: Could not load /Users/gcordero/dist/lds/packages/@ldsjs/recipes/src/foo.html (imported by /Users/gcordero/dist/lds/packages/@ldsjs/recipes/src/foo.ts): ENOENT: no such file or directory, open '/Users/gcordero/dist/lds/packages/@ldsjs/recipes/src/foo.html'
N/A
FYI @kevinv11n @davidturissini
This issue has been linked to a new work item: W-8256543
I wasn't able to reproduce the same bug: https://codesandbox.io/s/import-html-bug-repro-rz7dj?file=/src/modules/x/bar/bar.js. Note that import foo from 'foo.js'; is treated as a bare module import and not a relative import. If you want to resolve foo.js you can import foo from './foo';
@gonzalocordero Could you share provide a full bug repro for us to investigate?
@pmdartus Just realized this happens only when:
ts@rollup/plugin-typescript There are a few other issues I've encountered when using @rollup/plugin-typescript + @lwc/rollup-plugin, we can file those on a different category if you'd like and we can close this.
Thanks for taking a look!
Most helpful comment
@pmdartus Just realized this happens only when:
ts@rollup/plugin-typescriptThere are a few other issues I've encountered when using
@rollup/plugin-typescript+@lwc/rollup-plugin, we can file those on a different category if you'd like and we can close this.Thanks for taking a look!