0

I'm facing a problem in VSCode, I'm currently working on a next.js project, the problem is when I try to save the index.js file the HTML syntax is crashing, I don't know how to solve it, please help and thank you in advance

before saving screenshot_before_saving

after saving screenshot_after_saving

1
  • 1
    As Tomas said, check your "format on save" and formatter options in vscode. Commented Aug 13, 2021 at 21:01

3 Answers 3

1

well, this is just a guess but vs code may be interpreting your file wrong. It thinks it is just plain js but it is actually js + jsx and so you need to change the file from .js to .jsx. but to be honest it should work either way. just a guess.

Sign up to request clarification or add additional context in comments.

1 Comment

thank's it work< there was an XML format plugin when I uninstalled it, it worked
0

I faced the same issue and I happened because I have two formatter, you should disable the js-css-html formatter and user prettier formatter

Comments

0

Go to vs code settings.json and push this line of code into the object. 

"files.associations": {
    "*.js": "javascriptreact"
  },

Hope that will work.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.