[SalesForce] No MODULE named markup when importing CSS from a LWC

This is related to my other thread here.

So once I removed the HTML and JS files leaving just the CSS and XML files my consumerComponent is consuming the CSS from myComponent alright. I can see that it's picking up the css correctly.

However if I try to re-save the consumerComponent I get an error saying Error:(1, 1) No MODULE named markup://c:myComponent found : [markup://c:myComponent]

Has anybod successfully imported CSS from another LWC component? It appears that I can't make any further changes to my consumerComponent once I delete the html and js from myComponent. It just won't let me deploy although as I said the CSS is picking up correctly.

Best Answer

The parent component and shared CSS component must be deployed together. In addition, if you're using the SFDX CLI, there is a bug related to the shared CSS deployment and retrieval. You should be able to successfully deploy using Workbench. I've found that I can deploy the shared CSS component itself through the CLI, but I have to use Workbench to deploy the parent components. Just remember that you have to include both the parent component and the shared CSS component in your Workbench package.

Related Topic