Skip to content

Commit 9ff870a

Browse files
committed
file loader support added
1 parent 8824827 commit 9ff870a

File tree

7 files changed

+51
-4
lines changed

7 files changed

+51
-4
lines changed

config/webpack.dev.config.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,15 @@ module.exports = {
3131
{
3232
test: /\.css$/i,
3333
use: ['style-loader', 'css-loader'],
34-
}
34+
},
35+
{
36+
test: /\.(png|jpe?g|gif)$/i,
37+
use: [
38+
{
39+
loader: 'file-loader',
40+
},
41+
],
42+
},
3543
]
3644
},
3745
plugins: [

config/webpack.prod.config.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,15 @@ module.exports = {
3232
{
3333
test: /\.css$/i,
3434
use: ['style-loader', 'css-loader'],
35-
}
35+
},
36+
{
37+
test: /\.(png|jpe?g|gif)$/i,
38+
use: [
39+
{
40+
loader: 'file-loader',
41+
},
42+
],
43+
},
3644
]
3745
},
3846
plugins: [

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"eslint-plugin-jsx-a11y": "^6.2.3",
4343
"eslint-plugin-react": "^7.19.0",
4444
"eslint-plugin-react-hooks": "^2.5.1",
45+
"file-loader": "^6.0.0",
4546
"html-webpack-plugin": "^4.0.4",
4647
"identity-obj-proxy": "^3.0.0",
4748
"jest": "^25.3.0",

src/app.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import React from 'react';
2+
import logo from './logo.png';
23
import './app.scss';
34

45
export default function App() {
56
return (
6-
<div className="App--Container">Welcome to React Boilerplate!</div>
7+
<div className="App--Container">
8+
<img src={logo} className="App--Image" />
9+
</div>
710
);
811
}

src/app.scss

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1-
$bg-color: grey;
1+
$bg-color: transparent;
22
$txt-color: white;
33

4+
body {
5+
margin: 0px;
6+
}
7+
48
.App--Container {
59
display: flex;
610
flex: 1;
711
background: $bg-color;
812
color: $txt-color;
13+
padding: 0;
14+
margin: 0;
15+
}
16+
17+
.App--Image {
18+
height: 200px;
919
}

src/logo.png

59.9 KB
Loading

yarn.lock

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3712,6 +3712,14 @@ file-entry-cache@^5.0.1:
37123712
dependencies:
37133713
flat-cache "^2.0.1"
37143714

3715+
file-loader@^6.0.0:
3716+
version "6.0.0"
3717+
resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-6.0.0.tgz#97bbfaab7a2460c07bcbd72d3a6922407f67649f"
3718+
integrity sha512-/aMOAYEFXDdjG0wytpTL5YQLfZnnTmLNjn+AIrJ/6HVnTfDqLsVKUUwkDf4I4kgex36BvjuXEn/TX9B/1ESyqQ==
3719+
dependencies:
3720+
loader-utils "^2.0.0"
3721+
schema-utils "^2.6.5"
3722+
37153723
file-uri-to-path@1.0.0:
37163724
version "1.0.0"
37173725
resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd"
@@ -5489,6 +5497,15 @@ loader-utils@^1.1.0, loader-utils@^1.2.3, loader-utils@^1.4.0:
54895497
emojis-list "^3.0.0"
54905498
json5 "^1.0.1"
54915499

5500+
loader-utils@^2.0.0:
5501+
version "2.0.0"
5502+
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.0.tgz#e4cace5b816d425a166b5f097e10cd12b36064b0"
5503+
integrity sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==
5504+
dependencies:
5505+
big.js "^5.2.2"
5506+
emojis-list "^3.0.0"
5507+
json5 "^2.1.2"
5508+
54925509
locate-path@^2.0.0:
54935510
version "2.0.0"
54945511
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e"

0 commit comments

Comments
 (0)