I'm getting started with React 15. After going through tutorial and reading a few articles, I've come up with a few questions about the workflow. Here's how my index and webpack files look.
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Lugmety.com | The fastest, Most convenient way to order from the finest restaurants in Jeddah.</title>
<link rel="shortcut icon" href="assets/images/lugmety-favicon.png">
<link rel="stylesheet" href="assets/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/style.css">
</head>
<body>
<div id="app"></div>
<script src="assets/js/jquery.min.js"></script>
<script src="assetsjs/bootstrap.min.js"></script>
<script src="assets/js/scripts.js"></script>
<script src="/bundle.js"></script>
</body>
</html>
webpack.config.js
let webpack = require("webpack");
let path = require("path");
let DIST_DIR = path.resolve(__dirname,"dist");
let SRC_DIR = path.resolve(__dirname,"src");
let config = {
entry: SRC_DIR + "/index.js",
output: {
path: DIST_DIR + "/",
filename: "bundle.js",
publicPath: "/"
},
module:{
loaders:[
{
test: /\.css$/,
use: [ 'style-loader', 'css-loader' ]
},
{
test: /\.js?/,
include: SRC_DIR,
loader: "babel-loader",
query: {
presets:["react", "es2015", "stage-2"]
}
}
]
}
};
module.exports = config;
Here is my index.html file.
Does the compilation compile scripts like
jquery.js,bootstrap.jsand custom scripts for eg.script.jsand include it in the compiledbundle.js?In development, my
imagesare located insrc/assets/img/. I can't see the compiler copying assets into the dist folder.From where do I set the relative paths for the CSS and JS files in index.html and the images within components? For eg.
<img src="/assets/img/image.jpg">OR<img src="/src/assets/img/image.jpg">
Thanks a lot for your time.