Last active
April 19, 2024 15:21
-
-
Save CristianRP/cdf42a80fe366a90fadb38b33293b8db to your computer and use it in GitHub Desktop.
Revisions
-
CristianRP revised this gist
Apr 19, 2024 . 1 changed file with 15 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,6 +11,21 @@ yarn add [email protected] [email protected] [email protected] html-webpack yarn add -D typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin ts-loader ``` ### TS config (tsconfig.json) ```json { "compilerOptions": { "outDir": "./dist/", "noImplicitAny": true, "module": "ESNext", "target": "ES2020", "jsx": "react", "allowJs": true, "moduleResolution": "node" } } ``` ### Basic webpack.config.js ```js -
CristianRP created this gist
Apr 19, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,48 @@ # JS Project Setup with Webpack + TypeScript ### Install Webpack dependencies ``` yarn add [email protected] [email protected] [email protected] [email protected] nodemon @faker-js/faker ``` ### Install TS dependencies ``` yarn add -D typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin ts-loader ``` ### Basic webpack.config.js ```js const path = require('path'); const HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = { mode: 'development', devServer: { port: 8080, }, plugins: [ new HtmlWebpackPlugin({ template: './public/index.html', }) ], module: { rules: [ { test: /\.tsx?$/, use: 'ts-loader', exclude: /node_modules/, }, ], }, resolve: { extensions: ['.tsx', '.ts', '.js'], }, output: { filename: 'bundle.js', path: path.resolve(__dirname, 'dist'), }, } ```