Reputation: 371
the problem is when I add a composed link for example
<Route path="L1/L2" component={Comp}/>
when navigating to the Link the app can't Load the resources from public folder cause the app is loading the resources from example : http://localhost:8080/L1/bundle.js
instead of http://localhost:8080/bundle.js
I guess it's a problem in the webpack configuration but couldn't fix it
here is my webpack config :
var config = {
devtool: 'eval-source-map',
entry: __dirname + "/app/Index.js",
output: {
path: __dirname + "/public",
filename: "bundle.js"
},
module: {
loaders: [{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['es2015','react']
}
}]
},
devServer: {
contentBase: "./public",
colors: true,
historyApiFallback: true,
inline: true
}
all help will be appreciated thank you in advance !
Upvotes: 0
Views: 39
Reputation: 18546
It's about how you load in your bundle in the index.html
:
<script src="bundle.js"></script>
is relative to the current url.
<script src="/bundle.js"></script>
is relative to the root.
Try the second version, it should work then.
Upvotes: 1