Skip to content

Instantly share code, notes, and snippets.

@yakkomajuri
Created February 21, 2021 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yakkomajuri/8b03526b8b67b5a1041fa49694eb970a to your computer and use it in GitHub Desktop.
Save yakkomajuri/8b03526b8b67b5a1041fa49694eb970a to your computer and use it in GitHub Desktop.
// webpack.config.js
const path = require('path')
const webpack = require('webpack')
module.exports = {
entry: './src/index.tsx', // our entry point, as mentioned earlier
mode: 'development',
module: {
rules: [
{
test: /\.[jt]sx?$/, // matches .js, .ts, and .tsx files
loader: 'babel-loader', // uses babel-loader for the specified file types (no ts-loader needed)
exclude: /node_modules/,
},
{
test: /\.css$/, // matches .css files only (i.e. not .scss, etc)
use: ['style-loader', 'css-loader'],
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
output: {
filename: 'bundle.js', // our output bundle
},
devServer: {
contentBase: path.join(__dirname, 'public/'),
port: 3000,
publicPath: 'http://localhost:3000/dist/',
hotOnly: true,
},
plugins: [new webpack.HotModuleReplacementPlugin()], // used for hot reloading when developing
devtool: 'eval-source-map', // builds high quality source maps
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment