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.

  • 1
    Did you delete the myComponent.js-meta.xml file, perchance? You do still need that file, despite not having a JS file in your component.
    – sfdcfox
    Jul 30 '20 at 22:03
  • Did not delete it. It's still there. A colleague pulled my component and said the css and XML files are still there.
    – Arthlete
    Jul 30 '20 at 22:43

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.