How to use line wrapping in CodeMirror 6

I am using CodeMirror 6, and in the CSS, I have styled the content element (.cm-content) with white-space: pre-wrap;, but it didn’t work. I tried inserting lineWrapping: true in here:

var editor = new EditorView({
    lineWrapping: true,
    parent: document.getElementById("editor")

But the line wrapping still didn’t work. Has anyone faced this issue, and if so, how do I fix it? What am I missing?

Your style is probably being overridden by the built-in styles. Try including EditorView.lineWrapping in your set of extensions.

I tried including it in my set of extensions, and it worked! Thank you so much!

How can line wrapping and font-size be changed dynamically (based on the user’s preferences)?