Skip to content

Commit

Permalink
Merge pull request josephv7#3 from iamjosephvarghese/bugfix/file-loader
Browse files Browse the repository at this point in the history
Add loader for files
  • Loading branch information
josephv7 authored Nov 5, 2018
2 parents d46d4c8 + 4d05c06 commit 725da37
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 19 deletions.
29 changes: 10 additions & 19 deletions build-utils/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ const htmlWebpackPlugin = require("html-webpack-plugin");

const config = {
entry: {
"main": "./src/index.js",
"registration": "./src/js/registration.js",
"login": "./src/js/login.js",
main: "./src/index.js",
registration: "./src/js/registration.js",
login: "./src/js/login.js"
},
output: {
filename: "[hash].[name].bundle.js",
Expand All @@ -23,23 +23,14 @@ const config = {
test: /\.(jpe?g|png|gif|svg)$/i,
use: [
{
loader: "url-loader",
options: {
limit: 1000
}
loader: "file-loader",
options: {}
}
]
},
{
test: /\.html$/,
loader: "html-loader"
},
{
test: /.ts?$/,
use: {
loader: "babel-loader"
},
exclude: /(node_modules|dist|build-utils|webpack.config.js)/
}
]
},
Expand All @@ -48,19 +39,19 @@ const config = {
new htmlWebpackPlugin({
filename: "index.html",
template: "./src/index.html",
chunks: ["main"],
chunks: ["main"]
}),
new htmlWebpackPlugin({
filename: "login.html",
template: "./src/login.html",
chunks: ["login"],
chunks: ["login"]
}),
new htmlWebpackPlugin({
filename: "registration.html",
template: "./src/registration.html",
chunks: ["registration"],
}),
chunks: ["registration"]
})
]
};

module.exports = config;
module.exports = config;
23 changes: 23 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"clean-webpack-plugin": "^0.1.19",
"copy-webpack-plugin": "^4.5.4",
"css-loader": "^1.0.0",
"file-loader": "^2.0.0",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^3.2.0",
"husky": "^1.1.2",
Expand Down
Binary file added src/image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@
</li> -->
<li>
<a href="login.html">Login</a>
<img src="./image.jpg" alt="image">
</li>
</ul>
</nav>
Expand Down

0 comments on commit 725da37

Please sign in to comment.