From 58c04ec1ddd6b9a81e07a097d5dfeeaa292437d8 Mon Sep 17 00:00:00 2001 From: andres alcocer Date: Thu, 24 Nov 2022 10:18:34 -0500 Subject: [PATCH] included source-maps for debugging locally --- README.md | 1 + webpack.config.js | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a9dd994..5dda490 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ This project is a simplified front end clone of Netflix. It was created with Rea - [ ] Update modal to current styling - [ ] Update carousel to current styling - [ ] Create movie page screen +- [ ] Migrate to Typescript ### Tools used diff --git a/webpack.config.js b/webpack.config.js index a441a7c..b732b9a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -4,7 +4,9 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin') const { CleanWebpackPlugin } = require('clean-webpack-plugin') const dotenv = require('dotenv') const webpack = require('webpack') -var path = require('path') +const prod = + (process.env.NODE_ENV ? process.env.NODE_ENV : '').trim() === 'production' +const path = require('path') module.exports = () => { // call dotenv and it will return an Object with a parsed key @@ -21,7 +23,11 @@ module.exports = () => { path: path.resolve(__dirname, 'dist'), filename: 'bundle.js', publicPath: '/', + clean: true, }, + mode: prod ? 'production' : 'development', + // Enable sourcemaps for debugging webpack's output. + devtool: prod ? 'none' : 'eval-source-map', module: { rules: [ {