DEV Community

Discussion on: Do you know webpack?

Collapse
 
wolfhoundjesse profile image
Jesse M. Holmes • Edited

In the beginning, each time I set up webpack I followed the documentation first to get it working at a basic level. Then I spent some time poking around in GitHub Repos to discover loaders people were using.

Another thing that helps is using google search tools to limit how far back you are searching as webpack loaders are constantly changing. For instance, there is some recent guidance to use mini-css-extract-plugin over extract-text-webpack-plugin for your CSS because of some compatibility issues with Webpack 4, and that comes with it's own caveat about style-loader. Here's a lengthy, informative article from May that has lots of information to gleam. Is it recent enough to be relevant? Only the JavaScript Lords know. 🤣

I may have some free time this afternoon or tomorrow (Sunday) if you want to dig into some of this stuff together, but hopefully someone else will come along and offer you a solid time. There are two musicians in this house, and that means running in all different directions this time of year, not to mention that Christmas season leads straight into contest season for brass bands! I've followed you so that we can DM.

One last thing; if getting comfortable with Webpack is holding you back from starting your next project, why don't you try splitting your time between absorbing the new tooling knowledge and tossing a project together with Parcel? I'm sure some folks would give the new guy the stink eye for being different, but it's honestly magical, for example, to have one dependency in your quick-and-dirty typescript project at the start and have it all come together.

Collapse
 
misterhtmlcss profile image
Roger K.

Hi! Yes I'd love to connect and absolutely I'll look at Parcel now. I was looking at it before, but it didn't seem so easy as advertised. I'll take a second look; my last look was a year ago. Message me when you feel you can confirm a time. I'll keep checking my messages.

Collapse
 
wolfhoundjesse profile image
Jesse M. Holmes

I felt the same way, but then this happened:

{
  "name": "react-typescript-by-example",
  "version": "1.0.0",
  "description": "A step-by-step example of building react apps with TypeScript and parcel",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "build": "parcel build src/index.html",
    "start": "parcel src/index.html"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "parcel-bundler": "^1.10.3",
  }
}

I mean, I don't even have my name on the thing. Ha! I thought it would get endlessly complicated once I threw react in, but:

"dependencies": {
    "parcel-bundler": "^1.10.3",
    "react": "^16.6.3",
    "react-dom": "^16.6.3"
  },
  "devDependencies": {
    "@types/react": "^16.7.7",
    "@types/react-dom": "^16.0.10",
    "typescript": "^3.1.6"
  }

I added the react pieces from npm, but parcel took care of the typescript for me. There is some babel configuration hidden away, too. My first bump happened when I tried to write some tests with .tsx extensions. Keep in mind, this is just something I'm playing around with and not an actual process, but I got over that bump by adding this ridiculous typescript configuration:

{
  "compilerOptions": {
    "jsx": "react"
  }
}

It made me laugh.

Thread Thread
 
misterhtmlcss profile image
Roger K.

Haha. That's awesome. I'm watching a YouTube video on Webpack 4 right now. It's morning still in Calgary so I love me some programming vids while I'm sipping my morning coffee. I'm watching a Parcel one next ;)