typeScript and Webpack

I code a little template for typeScript via webPack, my first step but that’s work. So if you’r like me and want type and class your code in javaScript…go it. And no hesitation to improve this newby template !

1 Like

I noticed that you uploaded your node_modules/ directory to your .git repository (which is usually not something you want to do), so I would at least create a file called .gitignore with the contents:

node_modules/
dist/

also, I’m not sure if the dist/index.html and dist/style.css files are generated from somewhere? If you put them there manually, it’s not a good idea to mix template files / content with the autogenerated content (specified with ‘outDir’ in the tsconfig.json). Also not sure if you intend to use the react framework in this project as well? (I only ask because I see some tsx loader code in the webpack config), so unless you also intend to pull in react & use it I would omit that code as well! (YAGNI! :slight_smile: )

In fact, I would just say stick with just Typescript here (until you need webpack features), and I would just do ‘build tool’ stuff with a simple cp -R in an npm script :slight_smile: (1 less dependency!), or even just have the static files (index.html) refer to build/export.js

Also, I just want to link to a nice blog post that I found useful about webpack: https://blog.andrewray.me/webpack-when-to-use-and-why/

hope this helps!

Thx a lot for the advice, I’m beginner with TypeScript, Webpack and I use Github like a little gnome… So I go fast on your link to became a human real coder.

Thx a lot @julian2

@julian2 I don’t find where I can set gitignoreI remenber when I create the repository I can do, but after is it possible or i must create a new repository and remove the older one ?

There’s a Create new file and other buttons on the left side of the Clone or download big green button:

You’re Gold Mine thx !!!

Cool, I remove node_modules… next step work on the index and css file to don’t push manualy like your suggestion @julian2