For staying with us on the Sportsmax zone, over the years, fans have been voicing concern about the lack of support for athletes by respective Caribbean governments. Just two weeks ago, we here at Sportsmax spoke to the Vincentian 800-meter national record holder, Shafiqa Maloney, who explained the difficulties she has been having to support herself financially and otherwise in preparation for Paris 2024 Olympics. In a quick response, Prime Minister Rao Gonzalez during a post-cabinet press conference or briefing pledged his government support for the 25-year-old. This young lady on Sportsmax, I listened to her and knew her and you offer and said to her, said to Eloise, this young lady has gone through a lot and she is deserving of the full support of the government. So Dr. Gonzalez joins us via Zoom now to further discuss his pledge of support. Prime Minister Gonzalez, welcome to the Sportsmax zone. We have spoken to you before on this show but pleasure to have you back on, sir. Welcome to the show. Good to see you, my brother and my sister and my other brother. Our Prime Minister, talk to us quickly about the advances that you would have made in this project since you addressed cabinet on helping Shafiqa. Thank you. Let me first of all say happy birthday to Shafiqa. She was 25 yesterday, at least that's what I've been advised. In fact, she told me the last time that the 27th is her birthday. So happy birthday, my dear Shafiqa. We have made advancement on two fronts, the governmental and the private sector in terms of support. There are two companies here. One a regional company with a footprint in St. Vincent and the Grenadines and one company originating in St. Vincent and the Grenadines which has a regional footprint. Both of them have responded quite well and they have made arrangements to provide support in addition to support to be provided by the government. In fact, last week at cabinet we approved some of the money to be sent to Shafiqa and also to handle Robyn. You may be familiar with him, he is an 800 meter runner, he was at university in Pennsylvania, he was at Jamaica College on a program there and the two companies I can name them, one is the Vincentian company with a regional footprint, Eastern Caribbean group of companies which is a flour mill, rice mill and animal feed mill. The corairs which is a branch, a local branch of the regional company, the regional conglomerate and Goddard's out of Barbados and I spoke to the chief executive officers of both companies locally here and they have either sent resources today in the process of sending because they were making all the relevant arrangements, go through all the governance arrangements to make sure that they secure the requisite approvals and in the case of the government of St. Vincent and the Grenadines, I was in touch with Shafiqa's agent in St. Vincent whom I know personally, she's a friend of mine and the requisite arrangements have been made, received a budget from Shafiqa for the period from now until the end of August. I've been sent also some details on the immigration situation and we are working at that, you know, it's easier to provide financial resources than in fact to get past some roadblocks in the US immigration system. Having said that PM, before we delve deeper into the entire issue, you can confirm that the visa issue is still being worked on so she will for sure miss the world indoor championship in Glasgow this weekend. I believe that she'd miss it. I don't think that that matter has been resolved as yet. But when I had spoken to her on the last occasion, I didn't get to speak to her over the last couple of days. I just got back from Ghana last evening from the Karakorne meeting. The matter had not yet been resolved. As far as I was advised, if there is any update which is better than that information that I have, well then I'd be very pleased to hear it. So that's the situation. In fact, you know, my brothers and my dear sister, in the case of Shafiqa, even as a young lady and I say I've known her, I've been involved with her since just 13 years old. She has first came to my attention by someone from St. Vincent and the Grenadines. She was a coach in Jamaica, Michael Oliver, the father of protege. The order of mercy. The order of mercy. You're not a brethren. You're not a brethren. We know him well. You're not a brethren. Actually, he's my family. Oh, he is. We are blood relations. So don't tamper with Aya and Aya. And we, as I have told persons in Shafiqa as a classic case, that the stone that the builder has rejected has now become the head corner stone. Prime Minister, my question is, you know, based on the situation and to me it was a heartbreaking situation to of course sit down and listen to her interview because I was off the show for that particular day. But of course listening to the interview to me was a really, really sad situation. And of course, even Shafiqa was almost close to tears. My question to you is how do we ensure that, you know, at least it doesn't reach to this level where they're on international television talking about things like this. And what will the SVG government at least as much as you can do put in place to ensure that, you know, the athletes at least get some sort of help? I want to give you an example of something. Yeah. And then I will speak generally and also specifically. Okay. If you permit me. Yeah, sure. And in an exercise of this, we have to be both critical and self critical and to be honest and straightforward with everybody. That's the way how I know to do it. Let's send the number, send Vincent and the Grenadines various entities in Saint Vincent and the Grenadines, send a number of athletes, for instance, to Jesse Foster, your college in Jamaica, or athletes training as coaches, some as athlete, developing athletes themselves. And last year, I think the government itself sent two persons. Last year, I was informed purely by because of my ease of accessibility to me. One one athlete called one student from Jesse Foster, telephone me and said, look, 14 of them are about to be closed out from their examinations because of a raise of monies. I said what you're talking about 14. The actual coaches or entities had sent these people, not the government. Yeah. And they had, I contacted immediately the director myself and gave the assurance that whatever the areas, the government of Saint Vincent will pay. It turned out to be 180,000 US dollars. Sometimes some coaches, some organizations send people to places. Yeah. And if you don't tell me, if you don't have it through the system, I'm not going to know. No, I'm not saying that this is the case with Safika, but I want to answer because your question, I'm answering you in an omnibus fashion and I drew an example here. I repeatedly been seen on the radio when I meet the coaches when I meet everybody.  Don't do them on your own because you're more than likely would end up in difficulties and problems. And I don't want to see that happen to any of our people, especially our young people. No, as I had said, in that statement I made, it wasn't actually after a press, it wasn't after a cabinet meeting. In the cabinet room, I had some young people and some principals with me from my constituency, celebrating 30 years of my representation in my constituency. And I was given some money to each of the schools in my constituency from my own pocket. And having done that, I then proceeded to speak to the issue of Safika. In sometime in September 2022, Safika had reached out to my office. And naturally, I sent this to the Ministry of Sports because she sent a budget with a significant number. I'm not saying it's a number beyond what is reasonable for an athlete for the first year. In fact, it was not out of the ballpark. And the answer that I got back after the Ministry of Sports had consulted with the various entities is that she was, in their opinion at the time, not deserving of support. This is why I say that this is a stone that the builder rejected. And I'm not calling names of any association or any person in the country. But clearly, the assessment which was made was a faulty assessment. And if I'm not correct in stating that it was an incorrect assessment, what this young lady has done. Going through all these difficulties, these trials and tribulations, when I have heard about it, when my wife drew to my attention the morning after I began to see the sports max interview until she drew to my attention, my immediate response is that she's deserving of support. And one of the things that I say all the time, look, this is a 24-year-old young lady now 25. God has given her a remarkable talent, a remarkable gift. She had gone through some difficulties and through all these challenges, she has emerged as a beacon of fresh hope. And when people go through the fire, so to speak, and they come out of the fire, they are still still. Those of us who have been around, those of us who have lived more years than we have remained and left to live, that we have to put our hands out and help these persons. But it is evident that not only in St. Vincent and the United Caribbean countries, there is an insufficient or an adequate interplay between sporting organizations and coaches and governments. There are lots of blame to go around. And I don't want to start to throw those things at my stage in life. I don't want to do that kind of a raking up. There is a beautiful poem which I had recited to Shafiqa when I spoke to her written by Daniel Williams, a poet from my country, now dead. Extraordinary human being entitled, we are the cenotaphs. Said we are all time. Only the future is ours to desecrate. The present is the past. Our father's mischiefs. You may be pleased to know that the poet didn't say that it's our mother's mischiefs, just our father's. Because perhaps like me, many persons in my case, I had a fantastic father. My mother fathered me. So the mischiefs we put at the feet of the father's. And I'm hoping that both in relation to Shafiqa and Handel. Handel Rubin. And others too, a lot of mostly drew my attention to another case of incension in St. Kitts, a young lady who is there as a student in St. Kitts. Look, you know in the case of Shafiqa, I think, and this is why the structures are important. I'm not saying brethren and sister in any ad hoc manner. And we have to do it in a carefully structured, ordered way. If Lord and Mercy, if the link between Lord of Mercy, between Michael Olivier and Shafiqa had not been quote-unquote interruption after she had left St. Kitts and went into the United States, this probably may not have happened because there would have been a link between us in a personal way. But these things shouldn't depend on personal links. Yes, I agree with you, Prime Minister. We have a lot more to go into on this issue. We have a break. We will come back and continue this discussion on the other side of the break, Prime Minister. Thank you very much. Thank you, Prime Minister of St. Vincent and the Grenadines. Ralph Gonzalez, after this. Very much for staying with us on the Sportsmax Zone. We are speaking with Dr. Ralph Gonzalez, the Prime Minister of St. Vincent and the Grenadines. And we are discussing the attendant issues relating to the Shafiqa Maloney situation. Remember, she had an interview with us here on the Sportsmax Zone where she detailed her issues as she prepares or difficulties as she prepares for the Paris Olympic Games. Subsequent to that, support was promised to her by Dr. Gonzalez and the St. Vincent and the Grenadines government. Dr. Gonzalez has said to us here today that some support has already been sent to her and some other support is being worked on in the final stages. And yes, she should have that pretty soon as well. But we've also expanded the conversation now, Dr. Gonzalez, and I note that before the break, you said that this cannot be done in an ad hoc way. And I'm very happy you went there because that is exactly where I wanted to go. And I asked the question, is it time that St. Vincent and the Grenadines, and by the way, this is not just for St. Vincent and the Grenadines. I think this is for many countries across the Caribbean to now formalize the way that athletes, and I use athletes as a general term because I really mean sportsmen and women, that we formalize the way that assistance is given to them. And I asked that question because if a formal system was in place, then we would not have been left in a position where a determination needed to be made as to whether Shafiqa Maloney deserved assistance. If the formal structure was in place, then it would likely say once you are at Olympic or World Championship qualifying standard, then you are eligible for this level of support. If you're within this range of qualifying for an Olympic or a World Championship, then you are entitled to this level of success. And you could possibly have tears to that support system. Is it time that we get there, and have you as the Prime Minister and as a government started those discussions as to how you are going to get there? Well, it's like you were inside my cabinet room just over a week ago when we were talking about this thing. I said there has to be a clearly articulated policy. And it has to be connected also to a kind of activism grounded in good governance within the organizations themselves, the Athletic Association, the Football Federation, the Swimming Association, and all the various entities which governments vote. Because you see what happens as you probably are aware. These sporting organizations rightly guard their own independence jealously. But often that is used to have just a handful of bureaucrats assuming suzerainty in those organizations. And for prolonged period of time, and they have the links with the regional and international organizations that it becomes almost an occupation and a way of life and living for them. Living off the hog so to speak. No. I don't have to interfere with your business internally. But surely it cannot be that the separateness must be such that we have a suicide pact and that the only people or the main victims of that suicide pact are really the young people. Suicide pact, I'm using it in a metaphoric sense. That they're the young people who suffer. There are certain aspects of what we do in St. Vincent and Grenadines in a formal way. First of all, we have a policy. If you play a sport for St. Vincent and Grenadines at the national level, you must either be at work or you must be at school. And I can't know all who are at work or at school if the associations through the ministry of sport don't tell me, don't tell us the government. That's the first. I'm not going to talk about building up physical facilities and all that. That we can talk about that otherwise. I'm talking about the issue which we are currently addressing and which is important that we focus on. I make sure that those who excel, even young athletes, my government makes them sporting ambassadors with the privilege of carrying a diplomatic passport. Prime Minister, before you go on from there, for the purposes of this discussion, I want to separate specific government support from support of associations. Because we know each individual association connected to a world governing body will get a certain allocation that they will use to run their associations. But specifically... Pause there for a moment. Remember I talked about the good governance in those associations. Reports come to me that there is much opaqueness and lack of transparency as to which association it's what money from which source and how those resources are applied or distributed. That's why I said I don't want to get in your internal business. And I don't want to get into internal business either. But the point is this. The point is this, my brother. Clearly, it can be that you separate yourself in such a way that you have such a wall of separation that in our own isolation from each other we have essentially what I call a suicide pact. We clearly have to have a proper meeting of minds. And then that is complicated too because we are free and democratic societies not like in some more centralized systems where you have individual coaches. And coaches can be so idiosyncratic as you are aware. And sometimes they don't want anybody to encroach on their terrain or their turf with their athletes and they will make their arrangements because the association is this or the association is that. I mean, I'm sure you're familiar with some of that in JA. I am familiar with a lot of it right across the Caribbean not just in Jamaica, but I do want to separate that though because I think that is something that we will eventually take up with the governing body for athletics in St. Vincent and the Grenadines. But I really want to zone in specifically on the government support and whether the government specific support can be formalized in such a way that an athlete can go on a website and say that, okay, given my performance, given my time this is the type of support that I'm entitled to and can apply for through the government. I agree with you 100%. But what happens? The things are not separate. They're connected. Even though they're distinct for analytic purposes in operational terms like for instance somebody comes to me or goes to the minister of sports the minister of sports may not have all the data. If you see what I mean, my brother they have to go to the association. What really, what are the recent performances of this or that athlete to see whether in the guidelines you're suggesting and I agree with you. But independent committees can be set up to find that information though, Prime Minister. I hear you, I understand it. You may feel it's best to go to the individual associations but the sports ministry can set up independent committees that can help to get and analyze that information. I really would love to see that whatever structures evolves rising out of what we're talking about that the ministry of sports can work in a more seamless manner concerned really with one thing only or principally the development of these young people as finished personalities to excel in whatever skill at the sport they have and beyond that that they will have meaningful lives because I don't want to see people in their glory years and after their glory years they live essentially glory years as athletes that they live in some kind of a genteel poverty or worse than genteel poverty. Absolute peenery as we have seen in some circumstances in our Caribbean. I want to see these individuals as finished personalities in every material particular. Not all of them going to end up as champions already for me. I will tell you this, this young lady whatever she does between now and the Olympics for me Ralph Gonzalez personally not as prime minister she's already a champion for me because the adversity she has come through and to have performed as well as she has done admittedly early in the season this is something remarkable and this young lady shows a strength of character she shows a determination and I believe that that is what is going to steal her for going ahead because she has something also to prove I think she has it in her to show people you know you think I couldn't make it you know you didn't have the confidence in me you didn't have the faith in my ability that's why I quoted just now from the sands the stone had to be rejected become the head corner stone we're fast running out of time really sorry for cutting you but we're fast running out of time and I have to get in this last one before we go because we have only about a minute but there has been an influx of Caribbean and African athletes at the high school level the under 20 level here in Jamaica you spoke about the athletes that have been sent to GC Foster College that is the tertiary level but Saint Vincent and the Grenadines one of the leading nations in terms of the number of overseas athletes that compete in the Jamaican high school system in fact as you may well be aware now Amal Glasgow is one of the favourites for the class one boys 400 meters at Champs this year he's at Kingston College there's Devon Mac at Jamaica College you spoke about Handel Robin who went to Jamaica College as well and there are many others who are in the system or have come through the system I want you to talk to us quickly about how you feel about this development and a lot of your best and youngest talent being sent to Jamaica for development and whether there is an eye on one day being able to adequately develop your own athletes from that junior level well as I see it this Caribbean community is one if Jamaica and not if Jamaica has shown that in athletics it has particular facilities it has a certain track record it has an infrastructure and while we are seeking to build ours why not take our promising athletes once we have the proper support and for them to be protected and maintained in good order in Jamaica and I have no doubt with great love and caring fine and that we can work with one another and advance them while at the same time developing our own infrastructure and infrastructure here not only physical infrastructure but the infrastructure of coaches and the type of support systems we don't have the number of private sector companies which may provide support and we may not have in some of the schools what you do have in Jamaica I mean I lived in Jamaica for many many years I spent 7 years of my life in Jamaica so I know the land of wooden waters quite well and I don't what happens in Jamaica it's like what happens in St. Vincent and the Grenadines I think of us as one space so I would like us to continue to work in a collaborative in a collaborative manner and I'm very happy to see these young persons going to KC and JC and other schools and of course at the post-secondary level at JC Foster Prime Minister thank you so much by the way you were at Irvin weren't you? Oh please never never never I mean why do you want to offend me after this magnificent interview I I I I I'm a tailor man Oh you're a tailor right I'm a tailor right Oh my gosh I was president when I was president It's not Chancellor but okay No, well actually I lived on Block X in Chancellor Hall when I became president of this the Guild of Honour It makes a lot of sense now you got some of the greatness my friend Do not debil Do not debil Prime Minister we're out of time It's been an absolute pleasure speaking with you Thank you very much for joining us Come and look for me in St. Vincent Man I will, I will When you come, when you come make sure if you come in the wrong easter bring me some bun I have cheese Bring me some Hannah Tong Bakery bun Alright Alright Prime Minister take care Let's take a break on the sports mic zone We'll go back so much more to come


For kids, home is like a playground. They jump and they fall. But home can also present many hazards, often hidden in plain sight. October is Window Covering Safety Month and CPSC is asking parents and caregivers to use cordless window products. Go to cpsc.gov to get the latest info on cordless window coverings, along with helpful safety tips to keep your child safe. Got kids? Go cordless, a safety reminder from your friends at CPSC.


1815. The United States and Great Britain are at peace. The scene of frigate duels, blockading and privateering are now great highways between rich markets. Fared and nourished by an ever-expanding seaborn trade, a new America grows out of the western wilderness. The Navy will play an important role during this golden era, 45 years of expansion following the War of 1812. It will protect Americans away from home and promote peaceful trade abroad. The Navy will contribute to military science, giving the United States newer and more powerful weapons with which to defend the nation at home and abroad. Its operations during the wars in Florida, Mexico and California will help extend the American frontier along the Gulf and west to the Pacific Ocean. Naval diplomacy will further American interests abroad and open Japan to the world without resort to arms. In peace, as in war, America needed her Navy, slave trade, revolution. These were but a few of the problems facing the United States Navy after the War of 1812. To deal with threats to the American flag, the Navy organized six naval squadrons. One for the Mediterranean Sea, another to cover the West Indies, a third to patrol the West African coast, a squadron for the South Atlantic, one for the Eastern Pacific, and a squadron to protect American interests in the Far East, or as it was then called, East India. First, a squadron for the Mediterranean. Algiers, strongest of the Barbary powers, had used the War of 1812 as an excuse to pillage American shipping. But on March 2, 1815, just a matter of days after the peace treaty with Britain was ratified, Congress declared war against Algiers. On June 17, an American squadron under Commodore Stephen Decatur engaged the flagship of the Algeria Navy and battered it into submission. Peace negotiations opened 12 days later, ending the war. In the Caribbean, American shipping faced another serious threat, pirates. Between 1815 and 1823, mariners reported nearly 3,000 cases of piracy in the West Indies. To meet this threat, the Navy established the West India Squadron in 1822. The duty was tough and dangerous. But by 1829, the Navy's West India Squadron had made the Caribbean safe for American shipping. Another trouble spot was off the coast of Africa. Here in 1820, the Navy established a patrol to curb slavery. Although condemned, the slave trade was a profitable business. The Navy remained on the alert off the West African coast, taking slavers and freeing their African prisoners. In the decade after the War of 1812, Spain's colonial empire in America crumbled. While the American people watched the struggle of their neighbors to the south with sympathy, some European power is talked of supporting Spain. In his annual message to Congress on December 2, 1823, President James Monroe condemned European interference in Latin America. He declared, the American continents by the free and independent condition which they have assumed and maintained are henceforth not to be considered as subjects for future colonization by any European powers. While Europe mulled over the Monroe Doctrine, two new American naval squadrons operated in trouble waters around Latin America. The Brazil Squadron kept a weather eye peeled for developments that might have affected American trade and policy in the South Atlantic. Off the west coasts of South and North America, the Pacific Squadron protected American interests in the Pacific Ocean. In the Oregon territory, the fur trade boomed. Another industry, whaling, brought scores of American ships to the Pacific and new responsibilities for the peacetime Navy. Other Americans fanned out over the Pacific, missionaries to Hawaii, Yankee merchants to take advantage of the rich China trade. By 1835, American trade was second only to Great Britain in the Pacific. But here too there was trouble. In Sumatra and China, pirates, turmoil. In 1835, the United States established the East India Squadron to protect and encourage American trade in the Far East. Commodore Lawrence Carney, flying his flag in the historic frigate constellation, commanded the East India Squadron which arrived off China in 1842. Carney's naval diplomacy enabled the United States to obtain trading rights in China equal to those granted to Great Britain. By the mid-1840s, the Navy had made much of the world safe for American commerce. In the Mediterranean, the West Indies, and off the coasts of Africa and South America, in the Pacific and Far East, the Navy pioneered trade protection and promotion. At home, the nation was assured of its Navy's protection with the establishment of the home squadron, a quickly available concentration of naval force on the East Coast. Now as canals, hard surface roads, and river boats made it easier for inland production to reach the coast, American merchants reached out confidently for new markets, assured of their Navy's worldwide support. And the growing republic benefited. Washington had seen many new faces since the British had burned the nation's capital in 1814. Men like James Monroe, John Quincy Adams, a naval minded New Englander, Andrew Jackson, the great general who told the American people, your Navy will not only protect your rich and flourishing commerce in distant seas, but it will enable you to reach and annoy the enemy and will give to defense its greatest efficiency by meeting danger at a distance from home. Jackson's successor was Martin Van Buren. When President Van Buren took office, the Navy stood on the threshold of momentous changes in ship construction and gun design. Except for refinements, ships and naval ordinance had not changed basically for centuries before 1840. Ships of the line, like the 120 gun Pennsylvania, were still symbols of naval power. Robert Fulton designed and built the twin hulled center wheel steam war vessel Demologus in 1815. The first steam driven warship ever constructed for any Navy. 22 years later, the Navy built the Fulton, 1837, the true beginning of the steam Navy. The Fulton's first skipper, Captain Matthew C. Perry, pioneered steam engineering and was instrumental in founding the engineer corps. His suggestions were used in the construction of the steam frigate Mississippi. This side wheeler was completed in 1842, but its exposed machinery was vulnerable to well-placed shot. The submerged screw propeller seemed to be the answer to this problem. Now the water itself would protect much of the warship's vital machinery. The first screw driven warship ever built, the Princeton, put to sea in 1844. Again, the United States had shown the way. By the time the Merrimack class screw frigates began operation in 1857, steam propulsion was established in the Navy. Revolutionary developments also took place in naval ordinance after 1840. Gun design had not changed much in the 250 years since the Spanish Armata. The solid shot smooth bore gun was still standard on warships. All this was to change. Solid shot gave way to explosive shells, and the first scientifically designed naval guns were ready for use at the Washington Navy Yard. Lieutenant John Dahlgren's experiment showed that the highest pressures were near the breach of the gun. Pressure then rapidly diminished as the projectile traveled along the bore. Dahlgren constructed a bottle shaped gun to conform to these pressure relationships. Improved in more powerful naval ordinance, forecast the end of the wooden warship. The iron clad was not far off. Meanwhile, the Navy played a leading role in furthering geographical knowledge. Six ships under Lieutenant Charles Wilkes left the United States in the summer of 1838, on a voyage of Pacific exploration lasting almost four years. The expedition surveyed the South Pacific to Australia, followed the Antarctic ice barrier nearly 1,000 miles, and proved that a great continent lay beyond this massive ice shelf. Increased knowledge of the sea brought on by such expeditions led to the establishment of the nautical almanac and hydrographic offices. Another result was the establishment in 1842 of the Naval Observatory under Lieutenant Matthew Fontaine Moray. His studies of the world's oceans and wind currents helped make navigation faster and safer. Moray, half-finder of the seas. At the same time, there were significant changes in naval administration. From 1815 to 1842, a board of three Navy commissioners assisted the Secretary of the Navy in administering the department. Then to meet the growing needs of the Navy, Congress established five bureaus, Navy yards and docks, construction, equipment and repairs, provisions and clothing, ordinance and hydrography, and of medicine and surgery. The Bureau of Medicine and Searchery grew out of the Navy's concern for the welfare of its sailors. Naval chaplains looked after the spiritual welfare of sailors on long overseas cruises. Chaplains also acted as school masters on board ship, but naval training was still pretty haphazard. The deficiency was met by a professional school for the Naval officer, founded at Fort Severn inapolis in 1845, through the efforts of George Bencroft, Secretary of the Navy. Commander Franklin Buchanan was the first superintendent of the Naval Academy. In the decade beginning 1835, the Navy faced troubles at home, first in the Florida Territory. Near Tampa, Seminole Indians massacred an Army detachment touching off the Seminole War. The war spread into southern Alabama and Georgia in 1836 with the revolt of the Creek Indians. To operate with the Army, almost the entire Marine Corps, under Colonel Commandant Henderson, proceeded to military outposts in Georgia and Alabama. The Marines fought successful campaigns against both Creek and Seminole's. A small fleet under Lieutenant Commander McLaughlin operated against the Seminole's in the Everglades until the war ended in 1842. The Navy's fleet of small sailing vessels, barges and canoes penetrated hundreds of miles into the swamps on the track of elusive Indians. No sooner were the Seminole's pacified in Florida than trouble flared in Texas. In 1836, this important part of Mexico revolted and established a republic. The United States annexed Texas in 1845. This caused Mexico to break off diplomatic relations with the United States. President Polk sent land and naval forces to protect American citizens and interests in Texas and Mexico. War broke out in May 1846. General Taylor's Army met the Mexicans in battle near the Rio Grande. While the Navy blockaded the Mexican coast and guarded the line of communication, Taylor's men marched toward Monterey. It was a tough campaign for these American infantrymen who had to fight dust and disease as well as the enemy. In 1847, plans changed. An advance on Mexico City from Vera Cruz instead of by way of Monterey. This call for a large-scale amphibious assault. Supported by naval gunboats and steamers under Commodore Conner, more than 10,000 troops were landed below the Mexican stronghold in March 1847. Vera Cruz was shelled, first by Captain Josiah Tatenow's gunboats. For sure, the Army needed more firepower. The Navy set up six heavy naval guns to pound the city. Naval gunners stood up against withering enemy fire. Vera Cruz fell on March 25th, and the Army and Marines moved on Mexico City. Naval forces now under Commodore Perry neutralized strong points along the coast while the Army pushed inland. The war was also fought in California where the Navy played a decisive role. In July 1846, Commodore Sloat put 250 sailors and Marines ashore to occupy Monterey, Mexican capital of California. Two days later, a naval force occupied San Francisco. Commodore Stockton, a relieved Sloat in command of the Pacific Squadron, then moved to take all of California with a spearhead of Marines, sailors from the fleet, and a battalion of California volunteers. On July 29th, his sailors and Marines captured San Diego. On August 4th, Santa Barbara. Two days later, San Pedro fell to the Navy. On August 13th, Marines took Los Angeles, but were driven back by the Mexicans after a siege of a week. This and another setback at San Pasquale on December 6th did not deter Stockton, who reorganized his forces to advance on Los Angeles from San Pedro. In January 1847, Stockton's force defeated the enemy at San Gabriel and La Mesa and reoccupied Los Angeles. Here, the Americans and Mexicans signed the Treaty of Coenga. The war was over in California. On the Gulf and Pacific coast of Mexico, the war continued until early 1848. In the Pacific, naval forces captured Guaymas, Macedlan, and San Blas and tightened the naval blockade of Mexico. Marines fought to the halls of Montezuma. Mexico capitulated, and the western border of the United States touched the Pacific. In Northern California, gold was discovered, and the race was on, most of the 49ers making the trip by sea. Across the waters that washed California shores was the Orient, Japan. A hermit, Japan. The Navy helped open Japan to the world. First, Commodore Biddle in 1846. He got as far as Tokyo Bay. Commodore James Glynn in the Sloup of War Preble arrived at Nagasaki three years later and obtained the release of a group of American castaways held there. In July 1853, Japanese fishermen on the shores of Tokyo Bay sighted Commodore Matthew C. Perry's black ships. Perry came prepared. He had force to use, if necessary, the steam warships Mississippi and Susquehanna, supported by other ships. But Perry also came armed with knowledge. His experts had studied Japan and Japanese customs. Intelligent diplomacy was Perry's main weapon. He made it clear from the beginning he would deal only with the highest appointed Japanese officials. On July 14, 1853, Perry's honor guard of some 400 sailors and Marines marched to a pavilion on the beach at Kurihama. With great pomp and display, Perry presented a letter from President Fillmore requesting friendly relations with Japan. The Japanese were impressed. Perry then left, promising to return for an answer the following year. By the time Perry's squadron returned in February 1854, the Japanese had decided to negotiate with the American commander. While American and Japanese officials framed the treaty, Perry's men entertained the curious Japanese officials with a naval side show. Marines showed off their marksmanship. Sailors demonstrated the telegraph. And engineers set up a model railroad to give Kimono-Klad dignitaries their first train ride. America and Japan concluded a treaty. It opened two ports to American trade. It guaranteed protection to shipwrecked American seamen.  Japan was open to the world. At the midpoint of the 19th century, the Navy fanned out over the globe on many exploring and surveying expeditions. To the river Jordan and the Dead Sea in the Holy Land, where camels pulled small boats across the desert plains. To the Arctic and into the jungles of Panama and West Africa. Naval ships surveyed the Atlantic for the first trans-oceanic cable and on extensive voyages again explored the Pacific, this time from Australia to the Arctic Ocean. As the clouds of civil war gathered in 1860, Americans could look back with pride on what their Navy had accomplished during this golden era. First of all, the Navy protected American citizens and promoted trade throughout the world. New markets were opened for American commerce and assurance given that the American flag would be respected wherever it was flown. Naval protection and promotion of trade helped boost the American merchant marine to a total of 2.5 million tons by the year 1860. Secondly, the Navy made important contributions in exploration, oceanography, steam engineering, and ordinance. A third accomplishment was the Navy's support of American military operations in Florida, Mexico, and California. These operations, particularly the Mexican War, added vast areas to the United States. In 1860, the nation reached from the Atlantic to the Pacific. Finally, naval officers in their role as diplomats and representatives of the American people abroad achieved results that strengthened the United States position among the nations. The Navy had demonstrated the vital role it must always play in peace as well as in war.


So, it's July 5th, 2018 and I wanted to take a look at something me and Chris Moore talked about in an interview about the upcoming version of Free NAS. Now, this is pretty cool. This is going to be the 11-2 beta. Now, the actual release is due on 7-9, but you can go to the nightlies and get on a sneak preview. I'm going to wait to do any in-depth testing until the actual beta comes out, but I wanted to at least do a quick video and do a look at it. Essentially, this is beta one, but it's not the official beta one. It's a nightly release. And a couple of the things I want to talk about that they added here is replace Warden with IOCage, add cloud sync encryption support. This is actually the real exciting one. Meltdown Mitigation, I'm less worried about because I trust the software running in here, but it's good. Trust me, it's good to have that. I'm not trying to say don't bother. It's a waste of time, but they are working on the mitigations on that. So, let's take a look at the dashboard. So, by default now, and you could switch to the new UI with previous versions, like the 11.1 series of Freedance, but it was pretty rough. And I never really used it because I didn't, I think I did a preview of it in a video, but it's not, I didn't think it was all that great. It had a lot of issues. They have really been working hard at this, and it looks a whole lot better. They polished it up quite a bit. I like the first screen when you log in, you get your version. It says master. It says the build date is July 3rd, 2018. This is the Freedance 11.2 nightlies, like I said. So, this is not the version that's going to come out on 7.9. As close to it as can be, I imagine they may have a couple of commits that they have between now and Monday, but for the most part, this is pretty much how the system is supposed to be looking. Now, among the things I thought was interesting that Chris had mentioned was some people like to see it on a phone or a tablet. And it does work on a phone or a tablet, so you can manage your system from this. And I think the thing is, I'm used to always just using a computer to manage it. But it's definitely, it takes a little bit longer to load, I think, when it does this, but like it could be that I'm running this in a VM and that's just part of how that works. But the layout, without thoroughly getting into it, does seem to work on the phone option here. So, kind of interesting. Log out, restart, shut down. That just worries me doing that from a phone. So, we're going to go back. It is responsive. It is a nice UI. It does have that option. We're not going to do the demo like that. It's just, I thought it was interesting that they offered it. Now, this is a departure from the usual Freeness layout that all of us are so used to, where some menus are on the side and some are across the top. But I got to admit, when you're trying to teach a new user that, I've been using it a long time, so it's easy. But for a new user, they're like, why are some menus on the top and some here? And I do like the consolidation of all the menus and the expanded dropdown so you can find things. Everything in here looks pretty clean, looks pretty nice. They have a nicer layout for just generally everything. I kind of like, especially when you're prompted at the dashboard, so you can see things like, you know, how the drives are doing. You can see the health of the drives and things like that, pull tank healthy, nice green. I imagine it turns red. I don't have an unhealthy tank here to demo it, but it's pretty clean. Now, I noticed, and it's probably because it's a nightly, that these aren't showing up. I don't have any information in here, but I'm not too worried about it. I actually use net data for all of my deeper diagnostics. It's integrated right into Freeness. I've done separate videos on it. You can load it on other servers. Services page. I like this too. The simple start, stop buttons, red and green, just kind of a cleaner look. Like they've done a nice job on all this. Also because you can get a lot of services in here. Nice to see that you can just filter it and it works really fast. It also has a couple different layout options, slim or the kind of more, what you may be used to, a tabular layout like this. So pretty cool. Sharing all that, mostly, you know, clean layout. That same common add the plus. I guess this is similar to the way Google added a lot of things. I see this in the Google dashboards like that material design. Where you can browse the path, little dropdowns, choose snapshot tasks if you have any assigned. I don't have any assigned to this, but all the features seem to be there where you can add the features to the objects and you can just check boxes.  So I do like all of this. Now the one exciting thing about this is gonna be the cloud support, cloud credentials. Now I've talked about this before. So the system has an ability to support cloud syncing with storage providers like AWS, Microsoft Azure or Backblaze and Google Cloud. Now Backblaze has really inexpensive storage and it's a great place to store quite a bit of things and a lot of people going, I wanna be able to sync all my data somewhere, but I don't know if I trust that provider. Fair enough, they have a solution for that. So I was gonna work out a video and I just never got around to doing it of how you pre-encrypt everything, then you sync it to the cloud. The problem is that's kind of a pain in a butt to do. It'd be much better if it was one step. Don't worry, free NAS people have this figured out. So I created just a test account that's not real, I'm gonna go over here to tasks and we'll go to cloud sync tests. We're gonna go ahead and add one here. Test, is it a poll or push? We're gonna push data over to the cloud. We're gonna choose Backblaze. I think it's gonna fail on validation here. So we'll wait for it to fail on, no problem. It does do a test to make sure that it's valid. You put the path in. If you wanna sync the data, copy the data, it's got options there. This is the part that's exciting that's coming up. So we have set encrypt files before transferred to the store. That's pretty cool. So we're using our clone crypt. And they have all the documentation here on it of how it works, so I'm gonna do some reading in this. So I'm gonna do a video on this once the beta is out and do some testing back and forth because I have a Backblaze account and test how good this works and how the encryption works and things like that. It also does encryption password and encryption salt. So I like that. It's definitely handy because now I feel as though it's got good strong encryption behind it. And this is a feature that I've been wanting for a long time. Be able to sync it and tell people, hey, you can sync it with a cloud, but you don't trust the cloud so you can do this. Now another nice advantage is if you're worried about this because someone brought this up before about problems they've had with different cloud providers. I take everything with a grain of salt about people's stories about problems. Sometimes they are the problem. Sometimes a cloud provider might be a problem. So seeing a single story and saying, oh, I lost files with Backblaze because there might be more to this story. Anyways, you can do this to multiple cloud providers. So if you don't have confidence in one, you can then choose another and at the same time and then cloud sync to both places. So that way you have the three, two, one backup or you have it a couple copies of it and two different cloud providers both encrypted and then you have a copy yourself. So it would take quite a global catastrophe for all of your data to go away. That being said, this is one of the features that I'm pretty excited about. Now the other stuff I'm gonna do some testing. I'm gonna test it on real hardware so I can actually see the results as opposed to testing in a VM. I have a old server that I have laying around that I'm gonna load the beta on to do some playing with all these things and I'll do a couple of videos on it of course and show you how this is coming along. But I really like the way this looks. Now a couple side notes, if you wanna load this up and test it, I've already done this to this particular VM but one of the prompts it has is would you like to upgrade to the latest version of features for a ZFS? It rolls up the ZFS to add extra features. The other side about that is you can't roll backwards to it. So if you do this to your main machine you're gonna be on this beta because there's not a downgrade to my knowledge to roll it back. It's kind of a move the data, bring it all back. The other thing I wanna point out is IO cage is in here. Now IO cage is replacement for the previous warden jails. It's the updated new version that's in the new versions of FreeNAS. I'm not an expert on it and I'll do some digging into it. I know I have problems running this in a VM. Like I said, FreeNAS is not really ever designed to run a VM. It's designed to run on raw hardware and I have some raw hardware I'm gonna be testing this with so I can do some testing with IO cage and with some of the other features that are supported on this. But overall, I really like it. It definitely is cool. I didn't wanna do too in depth on it until I get around to the actual beta which comes out Monday. Then I'll do some more videos but definitely take a look at it. And as always, if you find any bugs and things like that that's why our betas are open to the public like this is they want you to do some testing and that's what I wanna be doing on a machine and doing some syncing with our other machine to kind of run it through his paces and see what works, what doesn't work and fill out bug reports. And hopefully all will be perfectly smooth and we'll move to this version in production which I'm excited for. So it does need a refresh on the layout for the web interface. And this is a really nice job on the refresh here. I think they're doing a great job. It looks really nice. Other than this, this is the nightly like I said other than this not working everything else seems to work perfectly fine. I can't really do any testing until I put it on hardware with the VMs and Jails but I'm hoping that the VMs have been updated some time. I never found them to be great. That's why I haven't done a lot of videos on it but they have really been working diligently at enhancing the VMs. I think it might be some cool solutions for like the things we do with Unify. I would love to be able to run the Unify in a VM on a free NAS so we can have one box that has a massive amount of ZFS storage for like a camera system. That project's coming when I feel though this is all very stable I'll show how I get all that set up. I know you can run it in a jail. That comes with the pretty deep instructions as well but I'm hoping with IOCage, that gets even better as well. So I'll be coming videos on that in the short term. This definitely take a look at this. If you've got some extra hardware to load it on or a VM to play around with this and start filling out bug reports, check it out. This is the free NAS 11.1 beta slash nightly. First look at it, thanks. Oh, and if you want to go to the nightlies and if you're running like the stable version you just go to system update, choose nightlies, check in a little so there's an update you can install it. But don't do this on your production machine. Probably not the best idea.  Thanks for watching. If you liked this video, go ahead and click the thumbs up. Leave us some feedback below to let us know any details what you like and didn't like as well because we love hearing the feedback or if you just wanna say thanks, leave a comment. If you wanted to be notified of new videos as they come out, go ahead and hit the subscribe and the bell icon that lets YouTube know that you're interested in notifications. Hopefully they send them as we've learned with YouTube. Anyways, if you wanna contract us for consulting services you go ahead and hit launch systems.com and you can reach out to us for all the projects that we can do and help you. We work with a lot of small businesses, IT companies, even some large companies and you can farm different workout to us or just hire us as a consultant to help design your network. Also, if you wanna help the channel in other ways we have a Patreon. We have affiliate links. You'll find them in the description. You'll also find recommendations to other affiliate links and things you can sign up for on launch systems.com. Once again, thanks for watching and I'll see you in the next video.


Let's get started.  Oh, wait. Imagine that you actually have regular retrospectives and you're there discussing technical debt, the pain points you have in your development process, performance issues, and the like. And someone on your team chimes in and says, I think we should switch to Webpack. I've read a few tutorials and I think it should be pretty easy. Now imagine your response. This happened to me. And a year later, I've put together a talk called Look Before You Import, a Webpack Survival Guide for Rails Developers. My name is Ross Kaffenberger. I'm at Rosta on Twitter and GitHub. And I want to say congrats to you all. You made it to nearly the end of Rails Comp, second to last talk. So give yourselves a round of applause. When I found out I was speaking before Aaron Patterson, I was both excited and also a little relieved. See, I'm excited because he does some amazing work with Ruby. And generally, it's better to speak before Aaron than after him. And when I see this profile pic with the flowing locks, I recall that the original title for my talk was How to Webpack Without Losing Your Hair. One of my colleagues reminded me that I might not be the best person to give that talk. It's been a while since my hair is migrated to my face. And my imagination does get carried away from time to time. So when I'm doing amazing things in Ruby, this is what I think that I look like. Like I said, my name is Ross. And although this will be a very JavaScript focused talk, I do love Ruby, I like to think that I've worked hard to make a name for myself in Ruby open source software. And when I say make a name for myself in Ruby open source software, I mean literally the name for myself is in Ruby open source software. And speaking of great names, there's a Ruby conference coming up next month named Ross Comp. In my opinion, this is the best named Ruby conference out there. I'm very honored that they named the conference after me. That's not actually true, but it's in Amsterdam next month. So if you're there, let me know how it goes. I work for a company called LearnZillion. We are building curriculum as a service for K through 12 education. We're built on Rails and more recently Webpack. We're looking for an engineer to join our remote team. So check us out at learnzillion.com slash careers. I'm also a dad to a toddler and to a terrier. And I'm often asked by my colleagues, what's it like to be a dad? What's it like to have pets? And I can pretty much sum up my experience in one word that every day, each and every day of mine is filled with tons and tons of joy. So much joy I can imagine carrying around that joy in my hands. And if you all are inclined to have children yourself or pets, my hope for you is that your days will be filled with joy as well. So speaking of things that bring me joy, let's talk about Webpack. So about this time last year, my team has had built, we had built over several years our Rails app on the Rails asset pipeline. And so you can imagine for an application that's been around for several years, there's a lot of legacy code that's built up. So we had a heavy use of global variables in our JavaScript, JavaScript snippets in our Ruby templates, tons of Rails asset gems. And we weren't quite sure how this would all fit together as we were moving forward, our development experience had started to decline somewhat. It would take a long time for the page to refresh. We were frustrated that our use of source maps was somewhat limited. And so we made this decision. Let's switch over to Webpack. We had some vague idea that things would be better. Turns out for us, the task was not so easy. See, we had all these assumptions that we had made and part of the challenge was how do we get Webpack to work with our legacy decisions that we had made over time? But we had a lot to learn about Webpack itself. And so we had a lot of assumptions coming from our experience with the Rails asset pipeline that we assumed would just work in Webpack. And the problem with having a sprockets or Rails asset pipeline mindset when using Webpack, it's like a little bit like trying to fit a square peg into a round hole. So we made our job harder in ourself. And now that we've made the switch, we're better informed about how Webpack works, about what we do differently if we were to do it again. And so this is the talk now that I would have liked to have seen before I started. And hopefully, regardless of whether you're considering upgrading a legacy app or starting a Greenfield project on Webpack, I hope that we can pull out some lessons for everybody. So the main structure of this talk, we're gonna talk about three general scenarios that fall under the umbrella of packaging assets for the browser. We'll talk about six problems that our team encountered in making this switch to Webpack. And we'll come away with seven general lessons, survival tips that I think will be applicable to anyone considering this change. But first let's make sure that we're all on the same page about sprockets and Webpack. They're meant generally to solve the same problem which is packaging assets for the browser. And by assets, I mean JavaScript, style sheets, Web fonts, images. And it's important to understand that they go about trying to solve this problem in fundamentally different ways. And one of those key differences is how they group files together into one or fewer that are served to the browser. And so in sprockets, when it puts your JavaScript files together, it does file concatenation. And when that JavaScript is evaluated in the browser, it's evaluated in the global scope. Webpack is a static module bundler. That basically means each one of your files is converted to a module that has its own scope in the browser. And just this key difference has a lot of implications for the kinds of decisions you can make. And it took us a while to actually let this difference sink in. We had a vague sense when we made the switch that there'd be a lot of improvements. And now a year later, I'm really happy to say that that bet has paid off. We have better development tools I feel in the webpack environment alongside Rails. I feel that webpack is a better strategy for managing dependencies. There's a huge ecosystem bolstered by the large JavaScript community that we can more easily take advantage of. We can write our code in ES6, although I should say sprockets four, which is still in beta would allow you to do this as well. And we can take advantage of a lot of new features that are not present in sprockets or the Rails asset pipeline, one of which is dynamic code splitting, which I'll get to a little later. So despite all these great ideas and features and improvements, spend a little time researching webpack on the web and you'll come across quite a bit of emotion.  Some folks passionately hate webpack. Sometimes getting things to work is a little bit like trial and error, often because we don't necessarily understand everything that's going on. Some folks feel that webpack is over engineered and that all this work it might take to get this configuration right is really not of benefit to your team. There's even a website devoted to those WTF moments that folks have when trying to get webpack set up. And to be honest, I've had a few of those moments myself, some of which you'll see today. Although one of the key decision points for us to encourage us to make the switch was that Rails announced official webpack support through the webpacker gem last year. And so what webpacker basically does is try to bring Rails conventions, this Rails as Omicase approach convention over configuration, these ideas to webpack which generally doesn't make any decisions for you. It's fairly unopinionated and that goes slightly against what we typically think of as Rails philosophy. So this won't be a webpack tutorial. I will though recommend these three resources which really helped me understand and get up and running with webpack. This survived JS webpack book by Juho, the learning academy from Sean Larkin who really is the tireless spokesperson for webpack itself and webpack from nothing by David Copeland. So let's get into these survival scenarios, things that we encountered as we made this switch. So we had to address some challenges with organizing our code, with taming the dependencies that we were moving over to webpack, and predictable caching. So jumping into this first category, one of the first questions we have once we get webpack up and running in Rails environment is how do we organize our directory structure? And taking a step back to the Rails asset pipeline, the default layout typically for your JavaScript would be to place everything in your app assets, JavaScripts directory. Some special files in there would be configured to be pre-compiled to be output into the public directory when you wanna serve these assets in production. You might need to use some Rails configuration to say hey, in addition to application JS, I want these other files to be bundled up as well. Let's take a look at how the directory structure should look like when you integrate with webpacker. So taking this source code that we had in the Rails asset pipeline, you can move it over to the app JavaScript directory when you get webpack set up. A really nice feature of this separate layout is that you can run sprockets and webpack side by side. So what we actually did was move these files over one by one to get things working. And you'll notice that there's a special directory in under JavaScript called packs. It's just a term that webpacker created. But the generic term that it really refers to when webpack is called entry. And these would sort of correspond to those bundles that will then be output into the corresponding public directory. And in webpack parlance, this is called output. And really there's no extra configuration that needs to happen. Anything that goes into the packs directory, directory specifically JavaScript files will be pre-compiled, so to speak, into the public directory. Unfortunately, a lot of folks get this wrong. I pay quite a close attention, a lot of attention to the webpacker issues. And a lot of folks essentially report problems, not with webpacker, but that ultimately go down to misunderstanding how to organize their directory structure. See, instead of laying out their files this way, they make it look a little bit more like what we had in sprockets. They put everything in the packs directory, or this tends to be a common problem. That's kind of what we used to do in the Rails Asset Pipeline, so it must work in webpacker, right? Well, this actually is a problem. If you were to run your webpack build and pay close attention to the output, this will basically tell you a lot about what's happening when you build webpack. And you'll see every individual module in that packs directory get output or pre-compiled into the public directory. And webpack will say it's emitted. It's created a file for each one of those that should be served. That's probably not what you want. So really, this is just a quick fix. Just keep in mind this convention. Only put JavaScript files that you want to be bundled as entry points in that packs directory. And really, you should see only a limited number of files in that output. So survival tip number one, really, the main point here is don't assume just because things work a certain way in sprockets in the Rails Asset Pipeline that they'll work the same way in webpack and webpacker. All right, another issue that came up was we wanted to do something like how do you require tree in webpack? So we get this really nice directive in sprockets where we can include all the files in some directory automatically with this one line. So this actually doesn't work by default. If you were to import some directory in your ES6 code through webpack, you'd actually have to do a little bit of work to make this functionally the same. So an API that's very specific to a webpack build is called require context. And it acts a little bit like directory glob in Ruby. You would use this to build up a list of files within that directory. If you had an index directory, essentially an index file essentially aliases to that directory name. And you'd have to recurse, or excuse me, iterate over these files and require them one by one. What if you wanted to actually grab a component from that directory? Well, you have to do a little more work. You'd have to use the require context which builds up again that glob of files. You'd grab the module, you'd build up a list of modules. You'd have to give them some name by default. Maybe it's based off the file name. Then you'd export that out from the index file so that's available to other modules in your system. Okay, so it's all right if you didn't get all that, but the main point here is that you can do a lot of the things that you get in sprockets, but you have to give up a little more of that friendliness that we are used to, maybe more on the Ruby side. Webpack tends to give you a lot of flexibility and control and maybe the APIs aren't quite as nice as we'd like them. Just something to keep in mind. It can be easy to get frustrated when you're playing with these more low level concepts. Okay, so moving on to taming dependencies. And one strategy we used in our Rails Asset Pipeline that we wanted to bring over to Webpack, something called code splitting. So this is a simplified version of how our sprockets build looked a year ago. So we had an application.js and a vendor.js that we included on the page at the same time. Really the strategy here is to improve our long term caching. We would put the big libraries like jQuery and Lodash into our vendor.js module or a bundle and the rest of our source code was in application.js. And that might include some vendor libraries like some of these jQuery plugins. And I'm gonna highlight those two because we ran into a problem when we moved this concept of manual code splitting over to Webpack. So you can imagine, we tried to create an application in a vendor.js pack on our Webpacker side. And instead of include tags, we have pack tags now and we started moving jQuery over with an import from our node modules. And we could actually do the same with these jQuery plugins as well. And we were adding these to our bundles and we noticed that there was a problem. I would like to point out that one thing that we had to do to get this all to work, and this is specific to our needs, is that we told Webpack, which doesn't put anything in the global scope by default, is that we need jQuery to be available there because remember that we have a lot of this code in our Ruby templates that assumes jQuery is available in the global scope. That's how things worked in sprockets. And we can actually tell Webpack, do this just for jQuery, put it in the global scope. Turns out that that had some serious consequences for what we saw. Okay, so we're gonna step through the process of moving these dependencies over to Webpack. So we added jQuery and it becomes available in the global scope because of our configuration. And then we added this chosen js plugin. It turns out this is a fairly mature plugin. It hasn't been updated in a few years. You might be able to see where this is going. We could test to see that it worked on the DevTools and the browser. The chosen function was added to the jQuery object that's available globally. And then we pulled in slick carousel, it's another jQuery plugin that's actually fairly active. It's more, I would say, up to date. And we could see that that worked once we imported it into our application bundle. But then something happened that shook me to my core. All of a sudden, chosen was no longer defined and the functionality that we intended to provide was broken. I had no idea when I saw this how trying to do the same thing in Webpack that I'd done in Sprockets would just not work. Turns out that there's a great tool that you can add to your development environments to help you see what's going on inside your Webpack build. If you already use Webpack, I really encourage you to use the Webpack bundle analyzer. Webpacker gives you some configuration that makes it a bit easier to add in Webpack configuration. So you can add this plugin with some code that might look like this in your development configuration. And what Webpack bundle analyzer will do is give you a visualization of the relative size and contents of all the modules that you have in all the bundles that you're building. And you can actually click around and zoom in and get some stats. And so this is what our bundles looked like after we had added these plugins in jQuery. You might be able to see a small problem. It's actually a pretty big problem. On the right is our vendor bundle where we explicitly imported jQuery. And happily I can see that it was imported and included in that bundle. What I was not so happy about was that jQuery is also included in our application bundle. That's not what I wanted. So this is actually a big problem, especially when we were doing what we did, which was trying to put jQuery into the global scope. Well, guess what? The last version wins because there can only be one jQuery in the global scope. That meant any plugins we had added at some point got clobbered. We could prove this by looking at the source code of these plugins. So Chosen.js actually looks like this. I took away most of the functionality but there's this one key line. It assumes jQuery is in the global scope. So when we included it, it worked because that's how we configured our Webpack jQuery import. With SlickHair cells very different. It uses a more, I would say, modern pattern. It doesn't assume by default that jQuery is in the global scope. It has a snippet of code at the top of its library definition that looks like this. This is typically called the universal module definition. It actually tests for the presence of some common module loaders like CommonJS and AMD. And turns out that Webpack understands these snippets here.  I'm in the application bundle right now and no one else has required jQuery so I'm gonna go ahead and add it as a dependency. And that's why we were getting two versions. What we needed to do is tell Webpack, we want to include both of these bundles on the same page so you need to treat some of these common imports as one. So rather than manual code split like we had been doing, we needed to let Webpack do the work. Now there are a number of ways that you could approach this and it turns out unfortunately this code that I'm showing you here won't work in Webpack 4 of course. So we're using Webpack 3. It's maybe important to get the main concept which is that this plugin that we've added, it's called the Common's Chunk plugin, will extract all common modules into the vendor bundle. So if we require jQuery in both, it's only gonna end up in vendor. Just keep in mind we won't be able to do this in Webpack 4. So we could see that this worked when we looked back at this bundle analyzer and we could see that jQuery is now included and the vendor bundle's on the left. And our application bundle's actually gotten a little bit smaller because these common modules have all moved into the vendor bundle from application. And there's only one instance of jQuery now and our plugin started working again. This all brings me to my third survival tip. You really need to know your dependencies in Webpack because they might be bringing in dependencies that affect some assumptions that you've made in your configuration. All right, another issue that has come up that we've sort of alluded to indirectly. I call module shimming. This is basically applying transformations to your dependencies. We do this in Sprockets already. We have things called preprocessors that change say our copy script or our ES6 code into normal JavaScript. And it turns out there are a lot of preprocessors in Webpack that are much more powerful, I would say, than what we typically have in Sprockets. It turns out they're not called preprocessors though. They're called loaders. And I have alluded to this before already but we were putting jQuery into the global scope using something called an exposed loader which says expose something to the global scope. Again, we're looking at now some Webpacker configuration and we can add in a loader that's targeted only to jQuery dependencies. And we can say, hey, jQuery, when you're imported, expose the dollar variable to the global scope. And as you could have seen already, that caused some problems and we found a better way to address this issue while it did get our chosen JS plugin to work because it could find that jQuery dependency in the global scope. We could actually flip the problem around and address it from the other way. Instead of exposing jQuery to the global scope, we ultimately decided to change how chosen JS works. So we can use something called the imports loader to actually import the dependencies that it needs where it otherwise expected them to be available in the global scope. This is sort of like applying the universal module definition to an old dependency. And here again is some Webpacker configuration which says every time we try to import chosen JS, apply the imports loader and replace the jQuery and the dollar reference with an actual import to jQuery instead. That way we can inject the dependencies rather than assume that they're available in the global scope. That way we could start moving away from that typical sprocket's way of looking for things globally. So survival tip number four, if you have legacy dependencies, I highly recommend you fix them through these loaders to get them to work with Webpack or just get rid of them altogether if you have the time. Webpack really wants to force you into a certain way of doing things. All right, finally, predictable caching. Let's talk about fingerprints. So when we ran our build and we have these two bundles, just like we have in the Rails asset pipeline, we get fingerprints added to the file names. So for those who are unfamiliar, this represents a digest of the contents of these bundles. And what we want is for those digest to stay consistent if the contents don't change, so we can cache them for long term. And if the contents do change, we want that digest to update. So let's just imagine in our application pack we're doing something with some function we're importing and let's add a new dependency. And that dependency might actually just be very simple. It doesn't bring in new dependencies. It's just a plain module. And if we ran that build again, we could actually take a look and see if the fingerprints changed the way we would expect. Now, if I only changed the application bundle, I would expect that only the application fingerprint should change. You might be able to see where this is going. So this is before and this is after the change. This is the fingerprint for the application bundle before and after the change. And you can see that they're different. And unfortunately, if you look closely at the fingerprints of the vendor bundles before and after the change, they are also different. And at this point, I wanted to throw my computer out the window. I really had to search deep inside my soul to figure out what was happening. I must have had some real misunderstanding about how Webpack works. Like how could it be that caching is just broken? Turns out it actually kind of is. And to illustrate why I had to learn how Webpack works and I'm going to illustrate now. Let's imagine when you build your Webpack bundle, it's going to start at the entry file. It's a JavaScript file. And what Webpack will do is parse that file for all your import statements and pull in the dependencies that they refer to. And recursively, it will go through each of those dependencies, parse those files, and pull in the dependencies of them. So what you get is a directed graph of dependencies when you build Webpack. And Webpack will link all of these dependencies together. It will translate these imports into function calls in the browser that the browser can understand when these modules are then put into your bundle. It also will, Webpack will insert some code which I'll call the runtime that will make this all work. The runtime needs to keep track of these modules somehow. It will actually assign each module an ID which you can think of as indexes into an array. Literally that first entry file gets the ID zero and so on and so forth. Well, as you've seen earlier, we were actually using two bundles, vendor and application.js. And because we were pulling common modules into vendor.js, that meant the runtime also ended up in vendor.js. And when we made some kind of change to application.js, those IDs would have to change as well. We might insert a module, it needs to get an ID itself, other IDs might change as a result. And it turns out because the runtime keeps track of all those IDs, like a manifest file, any change that we made to the application bundle would cause the runtime to change. And since the runtime is in the vendor bundle, the vendor bundle would change as well, which is why those fingerprints were updated. Well, it turns out there's a quick fix to this. More configuration. So if you recall, this is what our common module configuration looks like and it turns out what we wanted to do, or one way to fix this, is to pull that runtime out of the vendor bundle. So we had to add yet another instance of this common chunks plugin to pull the runtime out. And we also added some other plugin here, it's called the hashed module IDs plugin, so that what basically it does is says, don't assign numeric IDs, actually have the IDs of each module represent the contents so they won't change if we shift things around. So the end result of that change meant the runtime was pulled into a separate bundle. So if we changed application.js, runtime would change as well, but vendor would stay the same and that was a compromise that we were willing to make to at least get vendor caching to be, I guess, stronger. Okay, so survival tip number five, you may need to understand a bit about how this runtime works. This is a completely new concept that we don't get in the Rails asset pipeline. And if you're looking at all this and you're starting to wonder, oh, dear God, why would I ever want to learn about all this stuff? I'd have to say that I want to leave you with, on a positive note here, so I want to come to one last issue that actually I feel is a real big win for bringing Webpack into your project called asynchronous bundles. So let's imagine some code that looks something like this where you're using a pretty large package to do something only some of the time. So for example, at LearnZillion, we use PDF.js to render PDF documents into Canvas elements, but we really only need this on one particular page of the site. And it wouldn't really make sense to put this in our vendor bundle and force users to download this package on every single page load. So what we can do is take this code, which would end up, which would place PDF.js in the vendor bundle with our configuration and use this one little trick here. So changing that import from statement to an import function call is actually very different behavior from Webpack's perspective. So to read this, what we're saying is only when this code is evaluated in the browser will Webpack make a request for this package, which is not in your vendor bundle anymore. When Webpack runs its build, it will actually separate this package out into its own bundle that it can then request on demand. When this function call actually returns a promise, which won't resolve until that package is downloaded only when this line is evaluated. And then we can then continue with whatever it was trying to do, in this case, render a PDF. Really, this is Webpack's sweet spot. In fact, it's the reason why the creator of Webpack wrote it was to get this asynchronous on demand loading. One little tip, if you're going to use this type of import, you would have to use a magic comment in the function definite or the function call here to ensure that this chunk or which chunk meaning bundle in Webpack terms is actually gets a consistent name. Again, Webpack doesn't always assume what you wanna do. So you have to tell it in this case, I wanna call it a certain name. And when you run this build, you can see now that we actually have a fourth bundle that's only used some of the time. And we're able to limit the size of these initial bundles that are included on the page load. Survival tip six, if you're gonna use Webpack, I really encourage you to prioritize using these asynchronous bundles. Otherwise, why to go to all the trouble of setting it up if you're not going to use what Webpack was really designed to do. All right, so we've covered all the issues that I've felt relevant to share today. And although you may not run into the same issues that we ran into, I really hope that you can see the bigger picture here about how some of the mindset we had coming from Sprockets really needed to be adjusted when we came to Webpack. That said, I have to agree with the author of this blog post that Rails with Webpack isn't for everyone. Don't switch just because you heard that it's cool, okay? I would encourage you to really consider the trade-offs. If you have an application that has a lot of JavaScript, if you want to take advantage of these new tools, that you want to use things like asynchronous bundle loading, yeah, maybe it's the right choice for you. You'll still probably have to invest some time to learn how it works. For other folks, maybe something like Sprockets 4 is good enough. And Webpacker really needs more support and attention, like DHH referenced in his opening keynote. It's a leaky abstraction, even though it hides from you a lot of the complexity that you might get, otherwise if you had to set up Webpack yourself, ultimately, when I used it at least, I still needed to understand how it all worked anyways. But you know what, that's actually a good thing. I feel like it's the start of something that can improve over time. Just keep in mind, you will have to stay up to date because this project moves very fast because Webpack itself is changing constantly. So survival tip, my final one, understand that Webpack and Sprockets are fundamentally different. They are set up in very different ways. They have different strategies for bundling your JavaScript code together. They have very different philosophies about what is considered best practice. As we saw, Webpack really doesn't try to solve caching for you. That's something that's left up to you. It tries to push you towards smaller bundles, not big ones. It wants you not to use global code, and maybe even not jQuery at all. And these are things that you may need to reconsider if you're going to make this switch. But most of all, I will probably be frustrating if this is your first time using Webpack. Keep a positive attitude. I know that this can be frustrating at times as I've experienced myself. If you remember these tips that I've shared with you, maybe if they didn't sink in fully, come back to them later, and I promise you will survive your Webpack journey. The slides for this talk will be up on my website, rosta.net, slash talks. And I really like answering questions about Webpack or other Ruby and Rails types of topics. Reach out to me, my email address. I'm Rosta on Twitter and GitHub. And thank you all for coming to RailsConf. Thank you for coming to my talk. Get home safe after Tender loves talk tonight and hope to talk to you all soon. Thank you.