[go: nahoru, domu]

Skip to content

Commit

Permalink
setup asset loader
Browse files Browse the repository at this point in the history
  • Loading branch information
brtvcl committed Oct 5, 2022
1 parent 74639df commit 5e3d3c0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<title>Peerbox</title>
</head>
<body>
<div id="root"></div>
Expand Down
4 changes: 4 additions & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import React from "react";
import icon from "./icon.svg";

console.log(icon);
const App = () => {

console.log("hello webpack");
return (
<div className="bg-green-400">
<h1>Hello Tailwind!</h1>
<img src={icon} width="40px" alt="" />
</div>
);
};
Expand Down
1 change: 1 addition & 0 deletions src/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module.exports = {
output: {
path: path.join(__dirname, "/dist"),
filename: "bundle.[contenthash].js",
assetModuleFilename: "asset/[hash][ext][query]",
clean: true,
},
module: {
Expand All @@ -25,17 +26,21 @@ module.exports = {
test: /\.css$/i,
use: [MiniCssExtractPlugin.loader, "css-loader", "postcss-loader"],
},
{
test: /\.(png|jpg|gif|svg)$/i,
type: "asset/resource"
}
],
},
resolve: {
extensions: ['.js', '.jsx']
extensions: [".js", ".jsx"]
},
plugins: [
new HtmlWebpackPlugin({
template: "./public/index.html"
}),
new MiniCssExtractPlugin({
filename:"style.[contenthash].css",
filename: "style.[contenthash].css",
})
],
devServer: {
Expand Down

0 comments on commit 5e3d3c0

Please sign in to comment.