Created
September 21, 2022 07:20
-
-
Save Tribhuwan-Joshi/00a5aa5e09039f8ae19715b71c0bb8ab to your computer and use it in GitHub Desktop.
webpack config with babel , tailwind and eslint
This file contains 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 characters
const path = require("path"); | |
const HtmlWebpackPlugin = require("html-webpack-plugin"); | |
module.exports = { | |
experiments: { | |
topLevelAwait: true, | |
}, | |
mode: "development", | |
entry: "./src/index.js", | |
output: { | |
path: path.resolve(__dirname, "dist"), | |
filename: "bundle.js", | |
clean: true, | |
assetModuleFilename: "[name][ext]", | |
}, | |
devServer: { | |
static: { | |
directory: path.resolve(__dirname, "dist"), | |
}, | |
port: 3000, | |
open: true, | |
hot: true, | |
compress: true, | |
historyApiFallback: true, | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.css$/i, | |
include: path.resolve(__dirname, "src"), | |
use: ["style-loader", "css-loader", "postcss-loader"], | |
}, | |
{ | |
test: /\.m?js$/, | |
exclude: /node_module/, | |
use: { | |
loader: 'babel-loader', | |
options: { | |
present: [ | |
['@babel/preset-env', { targets: "defaults" }] | |
] | |
} | |
} | |
}, | |
{ | |
test: /\.(png|svg|jpg|jpeg|gif)$/i, | |
type: "asset/resource", | |
}, | |
{ | |
test: /\.(mp3)$/i, | |
type: "asset", | |
}, | |
], | |
}, | |
plugins: [ | |
new HtmlWebpackPlugin({ | |
hash: true, | |
title: "My Awesome application", | |
myPageHeader: "Hello World", | |
template: "src/template.html", | |
filename: "index.html", // relative to root of the application | |
}), | |
], | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment