<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: The Spider</title>
    <description>The latest articles on DEV Community by The Spider (@thespider).</description>
    <link>https://dev.to/thespider</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F108476%2F00b096af-e367-441f-8498-ea730c7db84e.jpeg</url>
      <title>DEV Community: The Spider</title>
      <link>https://dev.to/thespider</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/thespider"/>
    <language>en</language>
    <item>
      <title>Meteor vs Next? A brutally honest answer</title>
      <dc:creator>The Spider</dc:creator>
      <pubDate>Thu, 04 Jun 2020 09:38:42 +0000</pubDate>
      <link>https://dev.to/thespider/meteor-vs-next-a-brutally-honest-answer-eah</link>
      <guid>https://dev.to/thespider/meteor-vs-next-a-brutally-honest-answer-eah</guid>
      <description>&lt;p&gt;Meteor is Awesome. Next is Awesome. I love both frameworks, but they cannot be compared. It’s not even apples compared to oranges. One is an apple and the other is a basket full of apples. The risk of this basket is that there is always this rotten apple that you might want to throw away even though you’ve now paid for it. The real question you should ask is does the price of buying the apples separately outweigh the price of buying 1 basket and throwing away some of them. Even more so, if you consider that the apples of the basket were picked by real apple experts, do you really want to take the risk of picking the wrong apples yourself?&lt;/p&gt;

&lt;p&gt;Both Next and Meteor have their purpose and what you should look at is what they give you vs what you have to build or throw away.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where Next.js shines
&lt;/h2&gt;

&lt;p&gt;Next.js is your apple. It’s an amazing view layer and it provides you with all the tooling needed to easily integrate your React frontend. Not only that, it follows some nice patterns to allow plug-ability which keeps your code-base nice and tidy. Some of the things where Next.js really shines is pre-rendering, serverside rendering + hydration, routing and optimized hot module replacement capabilities. In other words, it takes care of all the complex render related stuff and provides convenient functionalities to hydrate your components using &lt;a href="https://nextjs.org/docs/basic-features/data-fetching"&gt;getServerSideProps and getStaticProps&lt;/a&gt; and also a nice CLI tool to help you build and pre-render it for serverless purposes.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Next.js lacks
&lt;/h2&gt;

&lt;p&gt;One HUGE thing that Next.js doesn’t have though a solid thought trough state layer with best practices in how to use it. With state layer I mean both UI state and domain state. Luckily Next.js is React which means that you can be assured of powerful UI state capabilities using React hooks and the context API. &lt;/p&gt;

&lt;h3&gt;
  
  
  UI State is not domain state
&lt;/h3&gt;

&lt;p&gt;It should be clear that there is a huge difference between the UI state and domain state. Even more so, the way you manage domain state is totally different than UI state. There's an &lt;a href="https://medium.com/@abhiaiyer/domain-state-vs-ui-state-768c1271a41d"&gt;article&lt;/a&gt; with an excellent explanation about the difference between the two. &lt;/p&gt;

&lt;p&gt;In short: UI state is essentially the internal state of your components and layout. For example a dropdown that is open or a collapsed menu. View state is unique to an app. Domain state however is business related and is unique to a business. For example in a webshop domain state would be the products and product categories, for a blog this would be articles and the categories of those articles. The real downside of Next.js is on the domain state side, because there is none, except for the hydration helpers that I’ve just mentioned.&lt;/p&gt;

&lt;p&gt;Of course you could use a tool like &lt;a href="https://www.apollographql.com/"&gt;ApolloJS&lt;/a&gt;, but that means that you need to create another API application for its server and you need to install its client into the next project, provide it with all the boilerplate and create mechanisms to provide serverside rendering.&lt;/p&gt;

&lt;p&gt;I’ve seen most developers do Apollo Integrations or in fact any API integration VERY wrong, creating a fundamentally broken project that requires months of refactoring to get it in good shape. Its exactly this practice that developers in companies never get time for. &lt;/p&gt;

&lt;h3&gt;
  
  
  React's history of breaking changes
&lt;/h3&gt;

&lt;p&gt;Next.js is React. I’m very experienced in React, but I need to admit that React is a moving target. I would consider it a low level UI component abstraction with powerful state management tools like hooks and providers, but besides basic documentation for its tools, it does not promote many best practices with the result of having a very scattered community. That React is a low level API also reflects back on the number of breaking changes. React is at time of writing on version 17/18. Any project (that includes the Next based ones) that has been there for a couple of versions has had to go trough quite some refactor rounds just keep everything up to date. &lt;/p&gt;

&lt;h2&gt;
  
  
  Where Meteor shines
&lt;/h2&gt;

&lt;p&gt;Meteor is your basket of apples. It has mostly awesome stuff. Especially on the server. The server by default is typically THE frontender’s weekpoint. Since the introduction of so called BFF’s (Backend for frontends) - which promised to provide a proper abstraction over existing frontends I’ve seen people doing Express.js integrations that make me cringe. Even worse, without them knowing it, they are essentially reinventing something that Meteor OWNS to the core from when it first appeared 8 years ago (2012).&lt;/p&gt;

&lt;h3&gt;
  
  
  The Unfortunate Meteor Paradox
&lt;/h3&gt;

&lt;p&gt;It’s a paradox. People were shooting at Meteor, because it “was hard to make it work with existing backends”, but now we are introducing “BFF’s” that should provide the exact level of abstraction that Meteor gives us, but most devs fail to build an efficient toolkit that even closely matches that of Meteor. Even worse, I found myself diving into existing projects of just 2 years old and it unfortunately had to become my sole purpose to maintain parts of the API that I would never even have to touch in Meteor.&lt;/p&gt;

&lt;h3&gt;
  
  
  Microservices - The biggest argument against Meteor
&lt;/h3&gt;

&lt;p&gt;As some of you might know. Meteor has and still markets itself as a full-stack platform. This is the official guide catch-phrase: "Meteor is a full-stack JavaScript platform for developing modern web and mobile applications.".&lt;/p&gt;

&lt;p&gt;Somehow developers can't see the difference between a micro-service architecture and the term full-stack. Because of that they wrongly put Meteor into a corner of "not working as part of a large ecosystem". Did you know that micro-services themselves are "stacks"? Just look at ANY application that runs with SSR enabled. There is a server involved. Even more so, bigger sites often introduce the concept of BFF's to act as an API purely designed for 1 specific frontend. Meteor IS the ideal BFF AND your frontend. But what about Mongo and Minimongo? You don't 'have' to use it, but even for this there are some good reasons to do so - even if you don't have a Mongo database.&lt;/p&gt;

&lt;h3&gt;
  
  
  Minimongo is a undervalued domain state library
&lt;/h3&gt;

&lt;p&gt;Meteor works with, but also without Mongo. Most people dont realize this, but is very easy to NOT use &lt;a href="https://www.mongodb.com/"&gt;Mongo&lt;/a&gt;, but still Minimongo. Minimongo is the number 1 type of library that I always miss when building big UI interfaces. I get optimistic UI and server sync for free. In Apollo this is still very complex. Unfortunately Minimongo has been originally built to work closely with Mongo (hence the name) and that’s why people get confused by it. Best way to look at Minimongo is by looking at it as a full-stack domain data layer for the UI with powerful query and sync mechanisms. It’s NOT Mongo, but it does use similar powerful features. You can use ANY backend as has been proven by the &lt;a href="https://github.com/cult-of-coders/redis-oplog"&gt;Redis Oplog package&lt;/a&gt; and the &lt;a href="https://forums.meteor.com/t/meteor-with-mysql-can-it-benefit-like-mongo/26211/5"&gt;SQL integration layer&lt;/a&gt;. I’ve been using Meteor mostly on top of existing Rest backends. Here's the guide which illustrates how easy it is:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://guide.meteor.com/data-loading.html#loading-from-rest"&gt;https://guide.meteor.com/data-loading.html#loading-from-rest&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Meteor VS Apollo
&lt;/h3&gt;

&lt;p&gt;So what about Apollo Server then? Well… GraphQL is awesome. Complex, but awesome. It’s complex, because it has a high learning curve. It forces standards and introduces a different paradigm, but I do feel that it’s the way to go. Meteor’s &lt;a href="https://docs.meteor.com/api/ejson.html"&gt;EJSON&lt;/a&gt; actually provides similar capabilities and together with Meteor's &lt;a href="https://blog.meteor.com/introducing-ddp-6b40c6aff27d"&gt;DDP Protocol&lt;/a&gt; and Minimongo it provides all the tools you need. You could also use DDP without Minimongo and have your own UI state manager.&lt;/p&gt;

&lt;p&gt;EJSON + Minimongo is likely what has inspired the MDG folks to build a tool like ApolloJS. MDG is the company that initially built Meteor and later sort-of left Meteor to its faith and continued with ApolloJS. &lt;a href="https://blog.meteor.com/a-new-chapter-for-meteor-7b684320be4c"&gt;Tiny has acquired Meteor&lt;/a&gt; and seems to be igniting a spark in many idle Meteor developers. One thing that Apollo doesn't really have though is a high level API. It leaves integration of different tools to the developers and frameworks - which is good, but the same thing applies as what you see in the React community. Scattered practices and a lot of people creating API implementations that make me cringe.&lt;/p&gt;

&lt;p&gt;If you do like Apollo (Like me) then you might want to look at &lt;a href="https://www.apollographql.com/docs/react/integrations/meteor/"&gt;using Apollo with Meteor&lt;/a&gt;. This way you leverage Meteor's and Apollo's advantages&lt;/p&gt;

&lt;h3&gt;
  
  
  Meteor integrates well with Blaze, React, Vue, Angular and Svelte
&lt;/h3&gt;

&lt;p&gt;Meteor has a couple of “first class UI citizens” like Blaze, React and Svelte (Not tried Svelte, but it’s a cool new UI lib). It also provides &lt;a href="https://github.com/meteor-vue/vue-meteor"&gt;Vue integration&lt;/a&gt; - though 3th party - but it illustrates that integrations are doable, though admitted not that simple for un-experienced people - especially doing the HMR part is difficult, but in all fairness, try to nail that with &lt;a href="https://webpack.js.org/"&gt;Webpack&lt;/a&gt; for the server side..&lt;/p&gt;

&lt;p&gt;Another huge advantage of Meteor is its backwards compatibility and &lt;a href="https://github.com/meteor/meteor/blob/devel/History.md"&gt;history of baby bottom smooth transitions&lt;/a&gt; to major version upgrades. That’s in contrast with Next. Given that Next works on top of React, I must say that the Next team does a good job of simplifying the transitions though.&lt;/p&gt;

&lt;h2&gt;
  
  
  Meteor's downsides
&lt;/h2&gt;

&lt;p&gt;IMHO. Meteor’s biggest downside used to be its greatest asset, which is its built system. I love Meteor’s build-system, its very efficient in bundling for targeted clients. Old browser? Here’s a special bundle for you! Again I challenge you to try and configure such a feature with Webpack! The problem however is that most of the community has shifted towards Webpack, because of its plug-ability (Like WHY?! I just want my darn frontend to load magically, because build tools are boring… ain't nobody got time for that? No offence brilliant gods that maintain these things! I truly need and endorse you!). Somehow developers love doing these things themselves, because they think they are doing something really special - It’s horrifying. However a new trend is emerging. &lt;a href="https://www.npmjs.com/package/vite"&gt;Vite&lt;/a&gt; is an emerging tool that relies on just the basic stuff. It’s VERY fast and simple to setup. Meteor might benefit from this new trend - though there are many directions and options on how to benefit from it.&lt;/p&gt;

&lt;h3&gt;
  
  
  SSR and hydration
&lt;/h3&gt;

&lt;p&gt;Another downside is SSR and hydration for &lt;a href="https://docs.meteor.com/api/collections.html"&gt;Minimongo&lt;/a&gt;. However you could of course just integrate Apollo Server and Client with Meteor and have the best of both worlds: &lt;a href="https://www.apollographql.com/docs/react/integrations/meteor/"&gt;https://www.apollographql.com/docs/react/integrations/meteor/&lt;/a&gt; 1&lt;/p&gt;

&lt;h2&gt;
  
  
  In conclusion
&lt;/h2&gt;

&lt;p&gt;Admitted. Both frameworks are awesome, but they work on different levels. Next.js, Nuxt.js, Gridsome and many other UI frameworks focus on JUST the render layer. They are the shiny apples. They have excellent documentations and I love the communities (big mention to the Vue and Nuxt communities and of course @evanyou - once part of MDG - and &lt;a class="mentioned-user" href="https://dev.to/akryum"&gt;@akryum&lt;/a&gt; who has given us the Vue integration package for Meteor). Meteor is still a league of its own, because it's much more than 1 apple. It works with other tools like Apollo and the different UI libraries. You could even use Meteor’s server and integrate it with Next.js or Nuxt.js! In that case a package like &lt;a href="https://github.com/Gregivy/simpleddp"&gt;SimpleDDP&lt;/a&gt; might be helpful to easily connect Next to Meteor's DDP API Many devs do this. &lt;/p&gt;

&lt;p&gt;There are only a few frameworks that sort-of approach parts of Meteor’s API layer functionalities. One of them is &lt;a href="https://feathersjs.com/"&gt;Feathers.js&lt;/a&gt;, but it’s mainly focused on ‘just’ the API client / server part. Another one is &lt;a href="https://rxdb.info/"&gt;RxDB&lt;/a&gt;, but I see that one more as a replacement for Meteor’s DDP, Methods and Minimongo integration. Again, just 1 part of the total picture.&lt;/p&gt;

&lt;p&gt;The choice is up to you, but if your focus needs to be on features, I would choose Meteor. If you require only the UI part with very powerful features and things like static rendering, use Next. (That is if you decided that React is your tool of choice)&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>meteor</category>
      <category>nextjs</category>
      <category>framework</category>
    </item>
    <item>
      <title>4 reasons to attend any frontend conference</title>
      <dc:creator>The Spider</dc:creator>
      <pubDate>Mon, 16 Dec 2019 18:19:27 +0000</pubDate>
      <link>https://dev.to/thespider/4-reasons-to-attend-any-frontend-conference-2699</link>
      <guid>https://dev.to/thespider/4-reasons-to-attend-any-frontend-conference-2699</guid>
      <description>&lt;p&gt;I often get the question from fellow developers and business people: "Why should I or my developers attend a conference?". Here's my take as a seasoned developer with a strong focus on business.&lt;/p&gt;

&lt;h2&gt;
  
  
  1: It's by far the best way to explore new stuff
&lt;/h2&gt;

&lt;p&gt;The frontend world has become a complex landscape because of growing expectations from consumers and stakeholders. What makes it worse is the sheer number of directions your developers could follow to solve a specific problem. &lt;/p&gt;

&lt;p&gt;One solution for this is to attend conferences. It's a unique opportunity to meet other developers that face similar problems or they might have already come up with a solution of their own! &lt;/p&gt;

&lt;p&gt;A while ago I was attending a conference where a guy spoke about Micro Frontends. When we started discussing it during the after drinks, other developers of similar companies joined us. Then we decided to start a 'task-force' where we discuss our approaches online specifically targeted towards our shared use-cases and that worked for us! It was essentially speeding up our work and saved us months of trial and erroring by ourselves and 50 other developers!&lt;/p&gt;

&lt;p&gt;Imagine the cost saving here on human resources. Plus you get a lot of 'free' expertise from other developers and a chance to make them bond with your company!&lt;/p&gt;

&lt;h2&gt;
  
  
  2: Great opportunity to meet the experts
&lt;/h2&gt;

&lt;p&gt;The speakers at a conference are there for a reason. They either solved something in a unique way, have new insights to share or they are sharing the latest features of the frameworks that they are contributors or creators of. &lt;/p&gt;

&lt;p&gt;Let's say you are a Vue developer working with Nuxt.js. Then what's better than talking with the people that created Nuxt.js?! They are the experts, because they have created Nuxt.js with the intention to solve specific problems. They could help you and your company to tackle problems using that framework's best practices! &lt;/p&gt;

&lt;p&gt;Beat that, online tutorials! &lt;/p&gt;

&lt;h2&gt;
  
  
  3: It's good fun!
&lt;/h2&gt;

&lt;p&gt;I'm this guy that loves talking and discussing developer related stuff endlessly. Since conferences are mostly packed with like-minded people (fellow developers, software companies, designers, etc) it is a great way to talk with new people and share different perspectives on the same subjects. &lt;/p&gt;

&lt;p&gt;Most conferences also have after-parties with drinks where it's simply about having a good time. This promotes the community feeling and allowes people to connect in a different setup besides the professional environment of a company.&lt;/p&gt;

&lt;h2&gt;
  
  
  4: It's impossible to learn if you don't know what you need to learn
&lt;/h2&gt;

&lt;p&gt;The developers world is huge. There are so much patterns, architectures, concepts, soft-skills and languages and they all solve specific problems. It's easy to go onto Google and search for a concept that you are already aware of, but it's impossible to look for a concept from which you have no clue that it exists in the first place!&lt;/p&gt;

&lt;p&gt;Now imagine you allow your developers to take coaching classes (which can literally cost a lot of money). Which class or subject should they cover? &lt;/p&gt;

&lt;p&gt;Conferences and other people are the best place to stumble upon new concepts and give insights into what subjects your developers should be focussing on!&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Frontend Love and VueJS Amsterdam?
&lt;/h2&gt;

&lt;p&gt;At Frontend Love we strive to be the ultimate platform for experts, developers and companies to team up. The speakers and subjects are being chosen by our own developers and this has multiple reasons.&lt;/p&gt;

&lt;p&gt;Some of our developers are very active contributors to communities and open source projects. I personally love to talk about subjects that matter for developers and am able to give technical feedback on the topics themselves. This improves the quality of the talks and the schedule as a whole. Creating the schedule is actually our side-job!&lt;/p&gt;

&lt;p&gt;Also devs working on other companies means that we know what issues companies are dealing with and that's how we select the right experts for the stage! Its therefore guaranteed to be extremely valuable for your company and your developers to attend! &lt;/p&gt;

&lt;h3&gt;
  
  
  Our focus on developers sets us apart!
&lt;/h3&gt;

&lt;p&gt;Frontend Love is really focussed towards frontend developers. This is what sets Frontend Love apart from other huge conferences, where speakers often times have nothing to do with development in general. Our speakers are either developers, advocates or tutors! Some other conferences are mostly purely focussed on other companies and simply show the latest and greatest. Not so much towards developers, even though they sell it as if it is a technical conference.. &lt;/p&gt;

&lt;p&gt;Vue.JS Amsterdam is even more focussed towards (obviously) Vue specific stuff and even so, there is so much to talk about so many topics to cover...&lt;/p&gt;

&lt;p&gt;We still have tickets available for both  Frontend Love (19th February 2020) and our Vue.JS Amsterdam (20/21th February 2020):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://frontenddeveloperlove.com/"&gt;https://frontenddeveloperlove.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://vuejs.amsterdam/"&gt;https://vuejs.amsterdam/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>developer</category>
      <category>conference</category>
    </item>
    <item>
      <title>Using Webpack for API development!</title>
      <dc:creator>The Spider</dc:creator>
      <pubDate>Mon, 09 Dec 2019 14:46:25 +0000</pubDate>
      <link>https://dev.to/thespider/using-webpack-for-api-development-52g9</link>
      <guid>https://dev.to/thespider/using-webpack-for-api-development-52g9</guid>
      <description>&lt;p&gt;&lt;em&gt;Looking for the example with Webpack and Apollo Server? Here's the &lt;a href="https://github.com/chris-visser/webpack-apollo-server-example" rel="noopener noreferrer"&gt;Example repo on Github&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I just want to share this rather confusing fact. &lt;a href="https://webpack.js.org/" rel="noopener noreferrer"&gt;Webpack&lt;/a&gt; is 'not' a server. It's a development tool meant to create bundles. It 'packs' web stuff... &lt;/p&gt;

&lt;p&gt;In other words. You use webpack to build your app into something that can be ran by your Node version of choice or by a browser. You are the builder, Webpack is your conveyor belt and at the and of that tool chain will be an executable that can be started by the &lt;code&gt;node&lt;/code&gt; command or a tool like nodemon. &lt;/p&gt;

&lt;p&gt;Webpack works as follows:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You create a file with a module (file that exports a function or class)&lt;/li&gt;
&lt;li&gt;Webpack detects the module&lt;/li&gt;
&lt;li&gt;Webpack transforms this module into the format of your choice&lt;/li&gt;
&lt;li&gt;Webpack then adds this module into (typically) one javascript file called a "bundle". It's even called bundle.js in most cases&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fv6sos1mltnw57sk0qbyf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fv6sos1mltnw57sk0qbyf.png" alt="Typical Webpack packaging flow aka the Conveyor Belt"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you use &lt;a href="https://babeljs.io/" rel="noopener noreferrer"&gt;Babel&lt;/a&gt;, Webpack can then transform es7 style Javascript and make it compatible for people that use older versions of Javascript.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What is the webpack-dev-server?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/webpack/webpack-dev-server" rel="noopener noreferrer"&gt;Webpack dev server&lt;/a&gt; is in fact a simple 'server' that is pre-configured to serve your bundle during development. This is nice, because it allows you to develop an app quickly using stuff like &lt;a href=""&gt;Hot Module Reloading (HMR)&lt;/a&gt;. However, it is 'not' meant to be a tool for developing an API or any Backend App. Here's my reasoning:&lt;/p&gt;

&lt;p&gt;The webpack-dev-server is in fact a simple &lt;a href="https://expressjs.com/" rel="noopener noreferrer"&gt;Express server&lt;/a&gt; that uses the webpack-dev-middleware under the hood. Whenever you start it, it will run Webpack in 'watch' mode. This means that every change you make to your source code, will make Webpack transform this source and serve it for any browsers. This means that it's not only taking care of the conveyor belt, but it's also acting as a server that serves the bundle to a browser. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note that webpack-dev-server serves separately transformed modules (the modules are not being bundled) &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  What is Hot Module Reloading?
&lt;/h3&gt;

&lt;p&gt;The HMR principle works a bit different then the default Webpack bundler. Instead of creating a new bundle every time you make a change, it only transforms the modules, but keeps them as separate modules. Webpack-dev-server then serves these modules for your browser.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fvd2g4s9qi89t29ljjti2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fvd2g4s9qi89t29ljjti2.png" alt="Showing how Webpack dev server using Express to serve a bundle to a browser"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The webpack-dev-server runs a small layer of code called the HMR runtime. This runtime is connected via a websocket. This websocket is a realtime connection between your browser and your development server. Whenever your  modules change on the server, they will be pushed to the browser. The runtime will then replace that module without reloading the entire browser. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It should speak for itself that this runtime and its socket connection should not be part of your production app and should therefore only run in development mode.  &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Using Webpack for server or backend only
&lt;/h2&gt;

&lt;p&gt;People tend to think that since Webpack creates bundles, its most suitable for regular apps and not so much for APIs. That's mostly true, but it can be very useful for backends too! Should you do it? It depends.&lt;/p&gt;

&lt;p&gt;What's certain is that since this whole HMR Runtime functionality and browser stuff is not applicable to API development, you don't need webpack-dev-server. It's overkill for API development and only makes your setup more complex, but Webpack could still be a must have! &lt;/p&gt;

&lt;h3&gt;
  
  
  When to use Webpack for your API's
&lt;/h3&gt;

&lt;p&gt;Like I said. Webpack is a 'build' or 'transform' tool. You don't need it for development if you can run and reload your app easily using a tool like &lt;a href="https://nodemon.io/" rel="noopener noreferrer"&gt;Nodemon&lt;/a&gt;. At some point in time you need to run your API on some server though and that's where you want to use Webpack. Here's my take on when you should and shouldn't.&lt;/p&gt;

&lt;p&gt;If you simply require a reload of your API code whenever you make a change, then don't use Webpack for development. If you for example only require some Babel transforms, then simply use Nodemon in combination with a .babelrc file. &lt;/p&gt;

&lt;p&gt;The grey area starts when you need to configure more tools. For example, if you want to use Typescript. You could use the 'tsc' command in watch mode, but as soon as you need to combine Babel and &lt;a href="https://www.typescriptlang.org/" rel="noopener noreferrer"&gt;Typescript&lt;/a&gt;, it might be time to switch to Webpack. &lt;/p&gt;

&lt;p&gt;For me the clear boundary starts from when you need to include non-javascript files like graphql or SVG files and need to combine more then 2 transformers. &lt;/p&gt;

&lt;p&gt;In fact, whenever I build an &lt;a href="https://www.apollographql.com/docs/apollo-server/" rel="noopener noreferrer"&gt;Apollo Server&lt;/a&gt; API, my first choice would be using Webpack with Nodemon. &lt;/p&gt;

&lt;p&gt;A final development setup would be something like this for your Apollo Server of Express API:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fl8tr8r3oz3wod5o8ckg3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fl8tr8r3oz3wod5o8ckg3.png" alt="Webpack is responsible for packing the bundle and Nodemon for executing the bundle"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Simplifying the flow
&lt;/h3&gt;

&lt;p&gt;We now have 2 processes that we need to start for 1 app. The Webpack watcher and the Nodemon process. To simplify this a bit I'm often using &lt;a href="https://www.npmjs.com/package/npm-run-all" rel="noopener noreferrer"&gt;npm-run-all&lt;/a&gt; like below in my package.json:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;

  &lt;/span&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"dev"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"npm-run-all -p watch:src watch:dist"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"watch:src"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"webpack --config webpack.development.js"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"watch:dist"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"nodemon ./dist/bundle.js"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"build"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"webpack --config webpack.production.js"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Running &lt;code&gt;npm run dev&lt;/code&gt; will make npm-run-all start both the Webpack watcher and the Nodemon script. The final production build is ofcourse just the webpack script. I've also split up the Webpack configuration files for production and development and a file for common configurations like this:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

./webpack.common.js
./webpack.development.js
./webpack.production.js


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This is how the files look like:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;webpack.common.js&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Note that I've included the &lt;a href="https://www.npmjs.com/package/webpack-graphql-loader" rel="noopener noreferrer"&gt;webpack-graphql-loader&lt;/a&gt;. This allows me to have separate graphql files.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;path&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;module&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;rules&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;test&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\.&lt;/span&gt;&lt;span class="sr"&gt;graphql|&lt;/span&gt;&lt;span class="se"&gt;\.&lt;/span&gt;&lt;span class="sr"&gt;gql$/&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;loader&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;webpack-graphql-loader&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;output&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;__dirname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dist&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="na"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bundle.js&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;extensions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.js&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;target&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;node&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;em&gt;webpack.development.js&lt;/em&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;CleanWebpackPlugin&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;clean-webpack-plugin&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;merge&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;webpack-merge&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;nodeExternals&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;webpack-node-externals&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;webpack&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;webpack&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;common&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./webpack.common.js&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;merge&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;smart&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;common&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;development&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;watch&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;api&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./src/main.js&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;externals&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="nf"&gt;nodeExternals&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
      &lt;span class="na"&gt;whitelist&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;webpack/hot/poll?1000&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;CleanWebpackPlugin&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;webpack&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;HotModuleReplacementPlugin&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Also an important note is that you will need to configure Nodemon to only listen for changes on &lt;code&gt;./dist/bundle.js&lt;/code&gt;. This prevents unnecessary reloads. You can do that with a nodemon.json in your root:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"watch"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"dist/bundle.js"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;


&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now whenever you need to deploy, the below configuration would be suitable for production. You could deploy it to your &lt;a href="https://kubernetes.io/" rel="noopener noreferrer"&gt;Kubernetes&lt;/a&gt; and simply start the &lt;code&gt;./dist/bundle.js&lt;/code&gt; or combine this setup with for example the &lt;a href="https://serverless.com/cli/" rel="noopener noreferrer"&gt;Serverless framework&lt;/a&gt; to run it on &lt;a href="https://aws.amazon.com/lambda/" rel="noopener noreferrer"&gt;AWS Lambda&lt;/a&gt;, &lt;a href="https://azure.microsoft.com/" rel="noopener noreferrer"&gt;Azure&lt;/a&gt; or &lt;a href="https://cloud.google.com/" rel="noopener noreferrer"&gt;Google Cloud&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;webpack.production.js&lt;/em&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;CleanWebpackPlugin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;clean-webpack-plugin&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;merge&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;webpack-merge&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;nodeExternals&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;webpack-node-externals&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;path&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;common&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./webpack.common.js&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;merge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;common&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;devtool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;source-map&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;__dirname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;src/main.js&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)],&lt;/span&gt;
  &lt;span class="na"&gt;externals&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;nodeExternals&lt;/span&gt;&lt;span class="p"&gt;({})],&lt;/span&gt;
  &lt;span class="na"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;production&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;CleanWebpackPlugin&lt;/span&gt;&lt;span class="p"&gt;()]&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;That's it. I can now simply create a &lt;code&gt;./src&lt;/code&gt; file and build my application by simply following the &lt;a href="https://www.apollographql.com/docs/apollo-server/" rel="noopener noreferrer"&gt;Apollo Server documentation&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;Again: Here's the &lt;a href="https://github.com/chris-visser/webpack-apollo-server-example" rel="noopener noreferrer"&gt;Webpack Apollo Server&lt;/a&gt; example repository.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Webpack is a powerful tool that can be used for both app and API development, but it's easy to drown in its feature set tricking you into thinking that it's more like for example a Node server. When that happens, remember what Webpack actually is - A very powerful and pluggable conveyor belt that 'packs' your app.&lt;/p&gt;

&lt;p&gt;In later articles I will focus more on the actual setup side of a project and how you could structure your project to make it simple, but very scalable using patterns like the above Webpack setup.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>webpack</category>
      <category>node</category>
    </item>
  </channel>
</rss>
