0

ModuleNotFound exception throws when deploying css file. I have started to explore Sitecore-Jss and deployed sample app in the sitecore and it works fine. I just added a new css file (test.css) under src/assets folder and refers the same in Layout.js file. Below is the test.css file content.

.tint-gray-light {
  background-image: url("../images/gray-light-70.png");
}

From the command prompt, I'm deploying using "jss deploy files" command and I'm getting below error. enter image description here

My current solution do not have any reference either for Images folder or image file. How to resolve the below error? where is this check happening?

Note: I'm about to develop existing page using sitecore jss and css file has many image references that are no longer referred in the webpage and do not even have images.

1 Answer 1

1

You're saying that your solution does not have an images folder, but your css is referencing a relative images folder "background-image: url("../images/gray-light-70.png");"

JSS is trying to find all the images that your CSS references in order to include them in the generated bundle.

Either add the folder and file that your CSS is expecting, or remove the reference from your css, and then the deploy will work as expected.

2
  • Removed references from the css file.
    – arjunan
    Feb 16, 2019 at 6:11
  • Also worth noting that this behavior is not specific to JSS apps. The JSS React sample uses Create React App (CRA) as a basis. CRA uses Webpack for building and bundling your javascript app, and Webpack will use whatever loaders are configured by CRA to resolve image/file paths.
    – Adam Weber
    Feb 16, 2019 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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