Unable to specify a specific import from a specific module
43081j opened this issue · comments
James Garbutt commented
So you provide two options:
moduleName
importName
Used like so:
// moduleName = module
import {x, y} from 'module';
x`test`; // parsed
y`test`; // parsed
// moduleName = module
// importName = y
import {x, y} from 'module';
x`test`; // parsed
y`test`; // parsed
y(whatever)`test`; // parsed
y.whatever`test`; // parsed
Surely this isn't how importName
should work. I would expect only tagged templates which use the specified import name to be parsed, rather than ALL imported names and the extra styled-specific stuff.
Like this:
// moduleName = module
// importName = y
import {x, y} from 'module';
x`test`; // NOT parsed
y`test`; // parsed
With this ability we could use the same component on other tagged template css libraries. Something like LitElement. But we can't yet because we over-parse:
css`this is css`; // parsed
html`this is html`; // parsed <- WRONG, it shouldn't be
Xianming Zhong commented
Agree with your feature request. But importName
is there. We have use another option name or try to enhance it. Like single string means the old usage, and an array is used to provide names whitelist.