Reese Witherspoon is opening up about how a role affected her mental health.

The Oscar-winning actress, 45, recently spoke with Tracee Ellis Ross for Interview magazine and revealed that her starring role in the 2014 movie "Wild" had an intense impact on her as she was preparing to film.

"I was so scared to do that, Tracee," Witherspoon said, noting that the role changed her more than any other. "I had hypnosis, I was so scared. I was having panic attacks for three weeks before I started."

"Wild" is based on writer Cheryl Strayed’s memoir "Wild: From Lost to Found on the Pacific Crest Trail" and follows Witherspoon’s character as she embarks on a journey on the Pacific Crest Trail after getting divorced.

REESE WITHERSPOON SAYS SHE, BRITNEY SPEARS WERE TREATED DIFFERENTLY BY THE MEDIA

Reese Witherspoon revealed that she had ‘panic attacks for 3 weeks’ before filming ‘Wild.’ (Photo by Alberto E. Rodriguez/Getty Images for The Hollywood Reporter)

Reese Witherspoon revealed that she had ‘panic attacks for 3 weeks’ before filming ‘Wild.’ (Photo by Alberto E. Rodriguez/Getty Images for The Hollywood Reporter)

"There was the nudity, sexuality, and drug-use aspect, but also being alone on camera with no other actors," remembered Witherspoon. "I hadn’t ever been alone in scenes for days and days. There were probably 25 days of the shoot where I had no other actor opposite me."

She added: "It was just me and a camera and a backpack. I was like, ‘Is this going to be so boring?’"

REESE WITHERSPOON CELEBRATES 10-YEAR ANNIVERSARY WITH JIM TOTH: ‘HERE’S TO MANY MORE DAYS IN THE SUN!'

The star said that she was also impacted by the "beautiful" book that the movie was based on "because it spoke to me so deeply about how we as women have to save ourselves."

"There’s no mother or father coming to save us. There’s no spouse," the "Legally Blonde" star continued. "I thought it was radical that at the end of the film, she ends up with no family, no money, no job, no partner, and she’s happy."

Witherspoon earned an Oscar nod for her performance and has since then taken a handful of lighter roles before returning to drama for "Big Little Lies," "Little Fires Everywhere" and "The Morning Show."

CLICK HERE TO GET THE FOX NEWS APP

She's also stepped behind the camera and become a juggernaut producer.

CLICK HERE TO SIGN UP FOR OUR ENTERTAINMENT NEWSLETTER

"I don’t know if I’ll ever work that hard again, but it changed me on a cellular level," she admitted.