-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does not generate definitions for imported stylesheets #48
Comments
Hi @k-g-a, that sounds good to me - thanks! I don't think it would break setups, but we could certainly test it. If you can make the PR with or without tests, that would be great - I can always add tests before getting the next release out this weekend. |
Great news, will make 2 PRs (for this and for the less) tomorrow |
Thank you! |
No problem. Those changes are quite small and are closely related, so I decided to make them via single PR :) |
Describe the bug
Even if we could use
@import
statements without throwing an error about plugin's async mode (i.e. viapostcss-import-sync2
plugin) - we still don't get proper typings for such files.To Reproduce
Assuming we have:
./foo/index.css
with some relative imports:./foo/A.css
&./foo/B.css
postcss.config.js
:./some.js
file importing styles:We won't get typings for
styles
other than{}
, because of the resolution error (from TSS_LOG):Expected behavior
Get proper typings.
Additional context
This bug occurs because of the following reasons:
postcss-import-sync2
plugin looks for sourceFile in AST statement:atRule.source.input.file
(here)options.root
, which isprocess.cwd()
(or passed option). at this point we could fix the problem by manually specifyingpath: []
option forpostcss-import-sync2
plugin, but thats not future-proof solution involving some magical knowledge to be shared almong developers.atRule.source.input.file
field is missing becauseDtsSnapshotCreator
does not provide thefrom
option topostcss.process
here.A simple one-line change (adding
{from: fileName}
as a second argument) fixes the problem for us, but i'm not sure if this could break some common setups.By the way, passing the same
fileName
asfilename
option toless.render
alongside with settingsyncImport: true
should fix #47.I can make a PR if it's proven to be the proper fix.
The text was updated successfully, but these errors were encountered: