Just like a chocolate-on-the-outside-cookie-on-the-inside candy bar, “Charlie and the Chocolate Factory” has always been a double-edged sword. It remains so in the 2017 musical version of Roald Dahl’s 1964 classic children’s novel. One moment, the audience is gleefully yoodle-lay-hee-heeing en masse through a yodeling sing-along. The next, the chief on-stage yodeler has been dispatched down a line of hatchet-wielding Oompa Loompas tasked with slicing him into fudge nuggets. “Charlie” has always been a tale of equal parts marzipan and murder.

Created by bookwriter David Greig, composer and lyricist Marc Shaiman and lyricist Scott Wittman (with songs from the 1971 movie version by Leslie Bricusse and Anthony Newley), “Charlie and the Chocolate Factory” churns through the duality to sweet effect.

Let’s jump to the Oompa Loompas, shall we? They are a tricky bit of business. In the book, they are described as pygmies from deepest Africa. In the 1971 movie (famously starring Gene Wilder as candyman Willy Wonka), they are little people with faces the hue of Flaming Cheetos six months beyond their eat-by date. In the 2005 movie (starring Johnny Depp as Willy) , the Oompa Loompas were all played by a single actor.

‘Charlie and the Chocolate Factory’
★★★1⁄2

When: Through Oct. 21
Where: Oriental Theatre, 24 W. Randolph
Tickets: $27 – $95
Info: BroadwayinChicago.com
Run time: 2 hours and 30 minutes, including one intermission

None of these options would work in a contemporary musical. Enter puppet designer Basil Twist, whose puppet chorus line of Oompa Loompas stops the show, cheerily singing “oompa loompa doompety doo” while brandishing cleavers and sporting grins that turn into manic rictuses while they watch bad children meet gruesome ends. Like much of the musical directed by Jack O’Brien, the Oompa Loompas are really funny, really disturbing and really good dancers. Creating dances for humans is hard enough. Coming up with a full-bore tap number for puppets? Credit choreographer Joshua Bergasse for ably managing both.

“Charlie” on stage is in two parts: The first act takes place outside the factory walls, as we meet Charlie (Henry Boshart opening night, Collin Jeffery and Rueby Wood at alternate performances) and the children who will be graced with a personal candy factory tour by the amazing Willy Wonka (Noah Weisberg). Post-intermission, we’re in Wonka’s world, watching young’uns drop like characters in a Stephen King novel. While Wonka’s factory interior is a bit of a letdown (Jeff Sugg’s video and projection design overwhelm Mark Thompson’s set), it’s good enough to keep things moving.

O’Brien’s cast is terrific. Weisberg’s Willy Wonka is not a nice man, at least not for the first roughly 2.25 hours of the 2.5-hour musical. He’s oblivious to Charlie’s abject poverty. He is unperturbed when a little girl’s puce-colored internal organs splatter across the factory floor. He delights in torturing his visitors with electric shocks. Even when Wonka softens slightly in the final scene, he’s more Joker than Santa. Which is exactly right.

But it’s Boshart’s guileless affability as Charlie that anchors the production. He’s adorable, he can sing with the intensity of a 120 percent pure cocoa candy bar and he never slips into treacle. You’re rooting for him throughout. The other kids are pretty alright too.

As the perpetually engorged Augustus Gloop, Matt Wood seems quite capable of — per the song — obliviously snacking on the family dachshund. Brynn Williams makes the gum-smacking Violet Beauregarde a fame-obsessed “queen of pop” celebutante whose entire life embodies the worst of a world where the likes of Heidi Montag can become a household name. Jessica Cohen gives the imperious Veruca Salt shades of Russian gymnast Svetlana Khorkina, post 2004 Olympics. And as Mike Teavee, Daniel Quadrino is a budding sociopath more at home in virtual reality than reality reality.

Charlie’s world is bleak but filled with love. His father is dead. His family subsists on rotten vegetables. Grandpa Joe (James Young, feisty and fun in his Zelig-like recollections of fighting at Gettysburg and Little Big Horn, among other exploits) hasn’t been out of the bed in 40 years. His mother (Amanda Rose, whose warm voice and lit-from-within presence embodies maternal love) works in a factory. But the Buckets love each other tremendously, and that gives the story a huge heart.

Shaiman’s music strikes the right balance as the score morphs from dulcet (“A Letter from Charlie Bucket”), to Golden Era MTV (“Queen of Pop”) to cacophonous thrasher (“Vidiots”). When Weisberg’s Wonka breaks out in “Candyland,” the effect is gently mesmerizing.

O’Brien’s design team does delightful work. Thompson, who does costume as well as set design, outfits the Buckets in earth tones; the Salts are all angular, tacky glitz proving that money cannot buy taste. The press corps (yes, there’s a press corps) is in black and white with red-all-over accents.

This “Charlie” is a cautionary tale and a romp of an adventure. And it will leave you wishing that someone would invent the incredible confections that make the Wonka brand magnificent. And perhaps open up a Wonka-inspired School for Grotesquely Inappropriate Children.