Week 1 (Rise of the Chroma Conclave / The Trials of Vasselheim / The Sunken Tomb)
Season 2
Episode 1
Editor’s Rating
4 stars
****
Photo: Courtesy of Prime Video
Welcome to the second season of The Legend of Vox Machina, Prime Video’s animated adaptation of the Critical Role web series in which a bunch of nerdy-ass voice actors play Dungeons & Dragons. I don’t know what getting a whole season of a TV show made and scheduled entails exactly, but I know it cannot be more challenging than scheduling a D&D session with your friends and their busy calendars. So The Legend of Vox Machina has the advantage there.
Based on this first batch of three episodes, the sophomore season also has an advantage over the first. It’s not quite a level-up, but the story — originally told over the course of hundreds of hours of livestreamed, improvised D&D play on Critical Role — seems more comfortable in this scripted, animated format than last season did. Everyone has a better sense of who these characters are and what sort of fantasy world they live in, so it’s easier to set them off on an adventure without feeling as if the show’s trying to prove something. And in the process, it has gotten better at tailoring its story and tone for the animated format, smoothing out some of the whiplash that makes D&D so fun to play but was sometimes distracting to watch.
Or maybe that’s because there wasn’t much room for jokes in the season premiere, which wastes no time before things get apocalyptic. Last season, Vox Machina — the adventuring party consisting of Vax’ildan, Vex’ahlia, Scanlan, Pike, Percy, Keyleth, and Grog — made heroes of themselves. Although the show started with a messy tavern brawl, the group soon took on much more important tasks, such as killing a blue dragon that had infiltrated the city of Emon’s leadership and defeating the Briarwoods, a pair of vampires who had held Percy’s home, Whitestone, hostage. Season two opens with them back in Emon as Sovereign Uriel announces his intention to abdicate the throne to usher in a better, safer Tal’Dorei. That lasts about 30 seconds before four gigantic kaiju-size dragons descend on the city and lay it to ruin in minutes. We learn they are the Chroma Conclave, representing an unprecedented threat to the realm (and one of the most beloved story lines from Critical Role’s first campaign). Dragons — especially those of different types — don’t typically get along, let alone work together. For four of them to have allied is supremely dangerous.
If there were times in the first season when the level of violence seemed a little showoff-y (“Haha, yeah! Look at this rad shit we’re doing in a cartoon!”), here the gore is entirely, horrifically earned. Vox Machina might have defeated a pair of powerful vampires last season and felled a blue dragon, but as they note, Brimscythe was much smaller compared with these four. Acid rain falling from the wings of the black dragon, Umbrasyl, melts innocents in the street; poison gas from the green dragon, Raishan, kills scores, including Sovereign Uriel; and the white dragon, Vorugal, flash-freezes victims with an explosion of ice. And lest you think a normal fire-breathing dragon seems generic after his fellow dragons’ unique, gruesome abilities, the series does something new and awe inspiring when the Thordak’s fire turns into a brilliant white beam that instantly levels the city. The stylistic choice to make the dragons computer generated, rather than the more traditional-looking animation of the human characters and backgrounds, sometimes sticks out, but here it only makes this sequence even more effective. The Chroma Conclave is not normal. It is out of Vox Machina’s league by an unfathomable degree.
It’s all Vox Machina can do to escape to Whitestone alongside Gilmore and a paltry number of refugees. When Gilmore or Scanlan crack wise, it’s not the sort of jarring comic relief that works while playing (or watching players) around a D&D table but less so in a theoretically more contained and controlled series. Here, it’s a coping mechanism — in-fiction comic relief rather than canon-bending goofs. Vox Machina has been so thoroughly defeated that Scanlan wants to cut and run. Only then do they see that Whitestone, having been freed from the Briarwood’s tyranny, has already started rebuilding. (Vox Machina’s influence!)
“Not bad for a bunch of assholes who got lucky,” says Vax. It’s the encouragement they need to take on the quest to defeat the Chroma Conclave. But as the brutally graphic sequence made clear, they don’t stand a chance on their own. Using Keyleth’s Druidic powers, they travel to Vasselheim, the strongest city in the world, to gather allies.
However, when they get to Vasselheim at the start of the second episode (after almost plunging to their deaths because of an unfortunately placed tree portal), they don’t find the help they’re looking for. Vasselheim is strong because of its isolationist policies, and the city’s leadership won’t go charging in to help Tal’Dorei. Instead, Vox Machina must turn to the Slayer’s Take, a hunting guild whom Vex kind of, sort of screwed over. She’s hopeful that her “old friend” Zahra will be sympathetic and down to hunt city-size dragons. However, when Vox Machina (minus Grog, whom we’ll get to in a second) gets there, neither Zahra nor Kashaw, another member of the guild, feels especially friendly. (Both are “guest” characters from Critical Role, meaning they were played by voice actors Mary Elizabeth McGlynn and Will Friedle rather than being NPCs voiced by Dungeon Master Matt Mercer.)
The guild is about to get revenge on Vex for stiffing them before the patron of Slayers Take, revealed to be a powerful, mysterious Sphinx named Osysa. Unlike the sphinx of Greek myth, however, Osysa doesn’t ask them riddles so much as she absolutely reads Vox Machina for filth. Nightmarelike sequences in which various characters are confronted with their own fears and shortcomings are common in genre storytelling, but The Legend of Vox Machina does a good job of making things visually interesting and disorienting as the party pinballs around an ever-changing orientation of stone pillars. Osysa’s critical assessment makes for some efficient characterization (Vax’s reliance on Vex, Percy’s self-loathing, Pike’s ongoing crisis of faith, etc.), but the best part comes when she just utterly ethers Scanlan.
“No one cares about you. I’m no different.”
“Damn” indeed, Scanlan.
Despite Osysa’s testing torment, the members of Vox Machina decide not to give in to their doubts and resolve to stand up to Osysa — and the Chroma Conclave and anything else that may come their way — because they want to do the right thing. Osysa is impressed with their moxie. Again, this sort of scene is pretty common in genre fiction, but The Legend of Vox Machina builds on tropes that are so baked into D&D and makes this acceptance of the call feel charming instead of cliché. The sphinx then tells the party to seek out powerful artifacts known as the Vestigates of Divergence, each associated with a different god, then points them in the direction of the first artifact, the Deathwalker’s Ward.
The Deathwalker’s Ward is associated with the Matron of Ravens, the goddess of death, and it’s fitting that this would be the first Vestige the group pursues because Vax has been seeing what appears to be the goddess herself, though he doesn’t know it yet. First in Emon, then on top of her temple in Vasselheim. Throughout these episodes, The Legend of Vox Machina is making sure to plant the seed for other story lines that Critical Role fans will be delighted to see coming. There’s the Matron of Ravens; the possible return of Percy’s one-handed nemesis, Ripley; a totally ordinary broomstick that definitely won’t ever fly, no sir; and Grog’s seemingly sentient cursed sword named Craven Edge. None of these threads gets pulled on too much, but the show is deftly laying the groundwork for plenty of story arcs to come.
Speaking of Grog, while the rest of Vox Machina is getting negged by a sphinx, he has wandered into an arena where an imposing man who identifies himself as Earthbreaker Groon, the dawn marshal of the Braving Grounds District, challenges him to a fight. Grog, ever confident in his strength, obviously accepts, only to get his ass absolutely handed to him by the old man. Earthbreaker Groon is trying to get Grog to realize where his strength comes from, but Grog, who is alone and separated from his friends — hinthint — can’t seem to figure it out. With butt thoroughly kicked, he reunites with the rest of Vox Machina, and the party heads off to Marrowglade Loch in search of the Deathwalker’s Ward, the Matron of Ravens’ own armor.
The third episode doesn’t need to do quite as much table setting (or city destroying) as the first two, and it’s largely a fun exercise in the more Indiana Jones–y side of D&D as the gang goes into some ruins looking for a MacGuffin. Vox Machina, joined by Zahra and Kashaw (who they correctly suspect are going to screw them over the first chance they get), realize that the tomb they’re looking for is submerged at the bottom of the lake. Keyleth and Zahra open a path to the typically underwater doors, Moses style, and soon they’re in a good old-fashioned dungeon! (Yes, yes, it’s a tomb, but it’s a dungeon in the D&D sense, complete with enemies and, as we’ll see, traps.)
The party gets temporarily split (natch), and they all get to show off how badass they are for the first time this season when they defeat the Merrow, who live in the tomb and prey on those foolish enough to get too close to the water. Vox Machina can’t put a scratch on a dragon, but throw a random encounter at them from a random page of The Monster Manual, and they can probably fuck up their opponents pretty good. Grog gets a little too into it, actually, and it’s becoming increasingly clear that the Craven Edge is a bad influence on sweet, stupid Grog.
The real emotional meat of the episode comes via flashbacks, as we learn more about Vex and Vax’s upbringing. The twins are half-elves, and their father, a stern elf named Syldor Vessar, is harsh and dismissive about his two half-human illegitimate children. The pair finally decide to escape this emotionally abusive setup and make a go of it on their own. These flashbacks, combined with Osysa’s assessment of Vax, show just how much the rogue relies on his ranger sister for support. Not just in battle (though she’s damn good with a bow) but emotionally. He doesn’t know what he’d do without her …
… And that becomes a problem when Percy accidentally triggers a trap while uncovering the Deathwalker’s Ward, killing Vex instantly. Even though resurrection is a thing in this fantasy world and Pike is a cleric who can cast such magic (as is Kashaw, who is off somewhere with Zahra), death is no laughing matter. In Critical Role, Dungeon Master Matt Mercer uses a custom tweak to D&D rules to add the possibility of failure to what could otherwise be a relatively stakes-free death and resurrection. Critical Role takes pains to make death not feel cheap in a medium where it easily could be by putting the emotional devastation on Vax after establishing the strength of his bond with Vex. The Legend of Vox Machina is making her death mean something, even if the audience might juuust have a suspicion that it won’t stick. It’s another way that, in these first three episodes, The Legend of Vox Machina is showcasing an even higher level of, well, dungeon mastery than the first season of the D&D-based story did.
How Do You Want to Do This?
• Hi! Belated introduction here. I’m James, and I’ll be recapping season two of The Legend of Vox Machina in three-episode batches each week. While I did not watch the first campaign of Critical Role that the show is based on (I became a Critter starting with the Mighty Nein campaign), I’m familiar with the events of campaign one (and I’ve interviewed pretty much the whole cast). I’ll be attempting to treat the show on its own merits because one of The Legend of Vox Machina’s strengths is that it should, in theory, work for non-Critters and even for folks who have never picked up a d20, but I’ll add a little context here and there.
• It’s amusing that, much like Critical Role (and D&D tables everywhere), The Legend of Vox Machina still doesn’t know quite what to do with rangers’ animal companions — in this case, Vex’s Golden Compass–lookin’ armor bear, Trinket. His absence needs to keep being explained because otherwise there would just be … a bear in scenes where there shouldn’t be a bear. At least he gets to do some cool stuff fighting the Merrow.
• Yes, playing a monk in D&D is exactly as fun as Earthbreaker Groon’s beatdown makes it seem.
• Thank goodness Grog finally got his beard. I hated looking at clean-shaven Grog. Felt so … wrong.
By submitting your email, you agree to our
Terms and Privacy Notice
and to receive email correspondence from us. This site is protected by reCAPTCHA and the Google
Privacy Policy and
Terms of Service apply.
or
Already a subscriber?
What is your email?
This email will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
Password must be at least 8 characters and contain:
Lower case letters (a-z)
Upper case letters (A-Z)
Numbers (0-9)
Special Characters (!@#$%^&*)
This password will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
You’re in!
As part of your account, you’ll receive occasional updates and offers from New York, which you can opt out of anytime.
or
Already a subscriber?
What is your email?
This email will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
Password must be at least 8 characters and contain:
Lower case letters (a-z)
Upper case letters (A-Z)
Numbers (0-9)
Special Characters (!@#$%^&*)
This password will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
You’re in!
As part of your account, you’ll receive occasional updates and offers from New York, which you can opt out of anytime.
Already a subscriber?
Already a subscriber?
`;
// integrate Sub(x) scripts and elements
if (hostname !== 'subs.nymag.com') { // do not integrate on this subdomain
document.head.appendChild(trackingScript);
document.body.insertAdjacentHTML('beforeend', subXAnimationElements);
}
There was an error processing the request. Please try again later."}).catch(e=>console.error("Error verifying email: ",e)))(r.querySelector(".content"),o.bannerCTAVerification)})):(l.remove(),s.remove()),o.dismissable||n.remove(),o.useAlertIcon||a.remove(),r.classList.add("show"),n.addEventListener("click",()=>{u(),r.classList.remove("show")})}else r.remove()}});
}, {"1":1,"6":6,"12":12,"35":35,"40":40}];
window.modules["global-nav.client"] = [function(require,module,exports){"use strict";const dom=require(4),auth=require(12),signInButton=dom.find(".user-signin"),signOutButton=dom.find(".user-signout"),globalNav=dom.find('[class^="global-nav"]'),body=dom.find("body"),dropdownItems=dom.findAll(".dropdown-wrap"),gtm=require(1),appendLandingPageParams=require(135),pageUri=require(124).getPageUri(),subscriptionPromoLinks=dom.findAll(".persist-params"),searchString=window.location.search||"";function closeDropdowns(e){let n=globalNav.querySelectorAll(".dropdown.open");dropdownItems.forEach(function(t){let o=t.querySelector(".dropdown");!n||t.contains(e.target)&&27!==e.keyCode||o.classList.remove("open")})}function gtmSendReport(e,n,t){let o={eventCategory:"ecommerce",eventAction:"componentClick",brand:e,dimension23:"global-nav",list:pageUri,pageZone:"header",variant:"nav-link"};"global-nav-link"===t&&(o.eventLabel=n.href),gtm.reportNow(o)}function updateElementTargetUrlsIfQueryStrings(e){if(searchString){const n=new URLSearchParams(searchString);let t=e.href;if(t.includes("?")){const o=t.split("?"),i=new URLSearchParams(o[1]);for(let e of n.entries())i.set(e[0],e[1]);t=`${o[0]}?${i.toString()}`,e.href=t}else e.href=`${t}?${n.toString()}`}}function init(e){const n=e.querySelectorAll(".to-landing-page");window.addEventListener("auth:init",()=>{signInButton.addEventListener("click",function(e){e.preventDefault(),auth.showEmbeddedLoginFlow("top navigation")}),signOutButton.addEventListener("click",function(e){e.preventDefault(),gtmSendReport("Sign Out",e.target,"user-info-link"),auth.logout()}),auth.isAuthenticated()&&e.classList.add("signed-in"),auth.isSubscriber()&&e.classList.add("subscribed"),e.querySelectorAll(".user-link").forEach(e=>{e.classList.add("active")}),subscriptionPromoLinks.forEach(e=>{updateElementTargetUrlsIfQueryStrings(e)}),appendLandingPageParams(n)})}dropdownItems.forEach(function(e){e.addEventListener("click",function(){e.querySelector(".dropdown").classList.toggle("open")})}),body.addEventListener("click",closeDropdowns),document.addEventListener("keydown",closeDropdowns),globalNav.addEventListener("click",function(e){let n=e.target;n.classList.contains("global-nav-track")&>mSendReport(n.text,n,"global-nav-link")}),module.exports=init;
}, {"1":1,"4":4,"12":12,"124":124,"135":135}];
window.modules["aaa-module-mounting.legacy"] = [function(require,module,exports){"use strict";const _pickBy=require(221),_each=require(406),Fingerprint2=require(408),DS=require(407),Eventify=require(246);function registerGlobals(){window.DS=DS,window.Eventify=Eventify,window.Fingerprint2=Fingerprint2,DS.value("Eventify",Eventify),DS.value("Fingerprint2",Fingerprint2),DS.value("$document",window.document),DS.value("$window",window)}function mountDollarSliceComponents(){DS.service("components",["$document","$module",function(e,n){var o=_pickBy(n.definitions,e=>e.providerStrategy===n.providers.controller),r=Object.keys(o);function t(e){return o=>{try{n.get(e,o)}catch(e){logMountError(o,e)}}}_each(r,n=>{var o=e.querySelectorAll('[data-uri*="/_components/'+n+'/"]'),r=e.querySelectorAll('[data-uri$="/_components/'+n+'"]');_each(o,t(n)),_each(r,t(n))}),this.components=r}]),DS.get("components")}function logMountError(e,n){const o=e.outerHTML.slice(0,e.outerHTML.indexOf(e.innerHTML));console.error("Error attaching controller to "+o,n)}registerGlobals(),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{mountDollarSliceComponents()}):mountDollarSliceComponents();
}, {"221":221,"246":246,"406":406,"407":407,"408":408}];
window.modules["ads.legacy"] = [function(require,module,exports){"use strict";const _map=require(118),_forEach=require(107),_isString=require(268),_intersectionWith=require(409),_isEqual=require(274),_each=require(406),_debounce=require(182),_sortBy=require(205),page=require(124),visit=require(114);DS.service("adService",["Eventify","$cid","$document","$window",function(e,t,a,i){var o,n,s,r,d,c,u,l,g={},p=this,h=[],f=visit.getQueryParamsObject(["utm_campaign"]),m=document.querySelector('script[data-type="ad-a9"]'),b=[],w=!1,v=[],y=document.querySelector('script[data-name="ad-doubleverify"]');document.querySelector('script[data-name="concert-ads"]')||(i.NYM={},i.NYM.analytics={},i.NYM.analytics.adStartTime=i.performance.now(),i.googletag=i.googletag||{},i.googletag.cmd=i.googletag.cmd||[],u=i.googletag,(m||y)&&(i.googletag.cmd=i.googletag.cmd||[],i.googletag.cmd.push(function(){i.googletag.pubads().disableInitialLoad()})),m&&(l=i.setInterval(function(){void 0!==window.apstag&&void 0!==window.apstag.timeout&&(i.clearInterval(l),window.apstag.cleared=!0,l=null)},10),setTimeout(function(){l&&(i.clearInterval(l),i.googletag.pubads().refresh(),window.apstag||console.log("MESSAGE: Timeout for A9 load exceeded, aborting"))},500)),y&&(b.push(new Promise(function(e){w?e():v.push(e)})),c=i.setTimeout(T,2500)),o=function(e){var t,a,o=e.data,n=[];return o.loaded?e:(o.loaded=!0,t=null,(t=o.sizes?u.defineSlot(o.name,o.sizes,o.id).addService(u.pubads()):u.defineOutOfPageSlot(o.name,o.id).addService(u.pubads())).setTargeting("adid",o.id),f.hasOwnProperty("utm_campaign")&&t.setTargeting("utmcamp",f.utm_campaign),a=p.getAdCount(o.label),t.setTargeting("label",o.label+"_"+o.site+"-"+a),u.display(o.id),u.pubads().addEventListener("slotOnload",function(){i.NYM.analytics.firstAdLoadTime||(i.NYM.analytics.firstAdLoadTime=i.performance.now(),i.NYM.analytics.firstAdLoadLabel=e.data.label)}),n=_(o),Promise.all(b).then(function(){n?window.apstag&&window.apstag.cleared?window.apstag.fetchBids({slots:[n],timeout:window.apstag.timeout},function(){u.cmd.push(function(){window.apstag.setDisplayBids(),u.pubads().refresh([t],{changeCorrelator:!1})})}):y&&u.pubads().refresh([t],{changeCorrelator:!1}):u.pubads().refresh([t],{changeCorrelator:!1})}),e.slot=t,e)},n=function(e){var a,i,o,n=t(),s=e.getAttribute("data-name"),r=e.getAttribute("data-sizes"),d=e.getAttribute("data-label"),c=e.getAttribute("data-site");n=e.id,r&&r.length?(r=r.split(","),a=[],_map(r,function(e){e=e.split("x"),i=parseInt(e[0]),o=parseInt(e[1]),a.push([i,o])})):(e.classList.add("oop"),a=!1),this.data={id:n,name:s,sizes:a,loaded:!1,label:d,site:c},g[n]=this},r=function(e){u.cmd.push(function(){var t=o(e);g[e.data.id]=t})},s=function(e){var t=[];e.slot?(t=_(e))&&window.apstag&&window.apstag.cleared&&window.apstag.fetchBids({slots:[t],timeout:window.apstag.timeout},function(){u.cmd.push(function(){window.apstag.setDisplayBids(),u.pubads().refresh([e.slot],{changeCorrelator:!1})})}):e&&r(e)},u.cmd.push(function(){var e,t,o,n=page.getMeta("article:tag"),s=page.getMeta("author"),r=i.location.href,d=(e=a.head.querySelector(".head-gtm"),t=a.body.querySelector(".gtm"),e&&"top"===e.getAttribute("data-gtm")?"gtmtop":t&&"bottom"===t.getAttribute("data-gtm")?"gtmbottom":"");o=[],_forEach([n,s,d],function(e){_forEach(e.split(","),function(e){(e=e.trim().toLowerCase().replace(/\s/g,"-").replace(/\'|\’/g,"")).length&&o.push(e)})}),u.pubads().setTargeting("kw",o),u.pubads().setTargeting("entry_group",o),r=r.slice(r.lastIndexOf("/")+1),u.pubads().setTargeting("pn",r),u.companionAds().setRefreshUnfilledSlots(!0),u.pubads().enableAsyncRendering(),u.enableServices()}),this.load=r,this.create=function(e){return new n(e)},this.refresh=function(e){var t;_isString(e)?(t=this.getById(e),s(t)):s(e)},this.remove=function(e){var t=e.data.id;a.getElementById(t).innerHTML=""},this.getAdCount=function(e){var t,a=0,i=Object.keys(g);return _each(i,function(i){(t=g[i]).data.loaded&&t.data.label===e&&a++}),a},this.getById=function(e){return g[e]},d=_debounce(function(){var e={TopLeaderboard:1,RightColTopMPU:2,outOfPage:99,"homepageTakeover/TopLeaderboard":1},t=_sortBy(h,function(t){return e[t.data.label]||10});_forEach(t,function(e){return e.data.sizes?r(e):i.setTimeout(function(){r(e)},2e3)}),y&&window.PQ.cmd.push(()=>{try{window.PQ.loadSignals(["ids","bsc","vlp"],T)}catch(e){T(),console.error(`There has been an error loading Double Verify signals: ${e}`)}}),h=[]},10),this.addToPageLoadQueue=function(e){h.push(e),d()});function _(e){var t,a=e.sizes;return a=_intersectionWith(a,[[970,250],[970,90],[728,90],[300,600],[300,250],[320,100],[320,50]],_isEqual),e.sizes&&e.sizes.length&&(t={slotID:e.id,sizes:a,slotName:e.label}),t}function T(){i.clearTimeout(c),w=!0,_forEach(v,function(e){e()})}}]);
}, {"107":107,"114":114,"118":118,"124":124,"182":182,"205":205,"268":268,"274":274,"406":406,"409":409}];
window.modules["cid.legacy"] = [function(require,module,exports){"use strict";DS.service("$cid",function(){var r=Math.floor(100*Math.random());return function(){return"cid-"+ ++r}});
}, {}];
window.modules["client.legacy"] = [function(require,module,exports){"use strict";require("cid.legacy"),require("ads.legacy"),require("facebook.legacy"),require("aaa-module-mounting.legacy");
}, {"cid.legacy":"cid.legacy","ads.legacy":"ads.legacy","facebook.legacy":"facebook.legacy","aaa-module-mounting.legacy":"aaa-module-mounting.legacy"}];
window.modules["facebook.legacy"] = [function(require,module,exports){"use strict";DS.service("facebook",[function(){this.fb=function(i){window.FB&&window.FB[i].apply(this,Array.prototype.slice.call(arguments,1))}}]);
}, {}];
require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o typeof key === 'string' && key.match(/\.legacy$/)).forEach(key => window.require(key));
}
function tryToMount(fn, el, name) {
try {
fn(el); // init the controller
} catch (e) {
const elementTag = el.outerHTML.slice(0, el.outerHTML.indexOf(el.innerHTML));
console.error(`Error initializing controller for "${name}" on "${elementTag}"`, e);
}
}
/**
* mount client.js component controllers
*/
function mountComponentModules() {
Object.keys(window.modules).filter(key => typeof key === 'string' && key.match(/\.client$/)).forEach(key => {
let controllerFn = window.require(key);
if (typeof controllerFn === 'function') {
const name = key.replace('.client', ''),
instancesSelector = `[data-uri*="_components/${name}/"]`,
defaultSelector = `[data-uri$="_components${name}"]`,
instances = document.querySelectorAll(instancesSelector),
defaults = document.querySelectorAll(defaultSelector);
for (let el of instances) {
tryToMount(controllerFn, el, name);
}
for (let el of defaults) {
tryToMount(controllerFn, el, name);
}
}
});
}
// Make sure that a `window.process.env.NODE_ENV` is available in the client for any dependencies,
// services, or components that could require it
// note: the `` value is swapped for the actual environment variable in /lib/cmd/compile/scripts.js
window.process = window.process || {};
window.process.env = window.process.env || {};
if (!window.process.env.NODE_ENV) {
window.process.env.NODE_ENV = '';
}
// note: legacy controllers that require legacy services (e.g. dollar-slice) must
// wait for DOMContentLoaded to initialize themselves, as the files themselves must be mounted first
mountLegacyServices();
mountComponentModules();
// ]]