Skip to content

Instantly share code, notes, and snippets.

@uselessdev
Created December 11, 2020 18:02
Show Gist options
  • Save uselessdev/64313763387fb1e95f4bd69bdef8d4fa to your computer and use it in GitHub Desktop.
Save uselessdev/64313763387fb1e95f4bd69bdef8d4fa to your computer and use it in GitHub Desktop.
import path from 'path'
import webpack from 'webpack'
import ReactRefreshPlugin from '@pmmmwh/react-refresh-webpack-plugin'
const config: webpack.Configuration = {
entry: path.resolve(__dirname, './src/index.tsx'),
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: {
plugins: ['react-refresh/babel'],
},
},
{
loader: 'ts-loader',
options: { transpileOnly: true },
},
],
},
],
},
resolve: {
extensions: ['.ts', '.tsx', '.js'],
alias: {
'@components': path.resolve(__dirname, 'src/components'),
'reset': path.resolve(__dirname, 'src/reset.tsx'),
},
},
plugins: [new ReactRefreshPlugin()],
output: {
path: path.resolve(__dirname, './public'),
filename: 'bundle.js',
},
devServer: {
contentBase: path.resolve(__dirname, './public'),
port: 3000,
open: true,
hot: true,
},
}
export default config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment