【发布时间】:2016-11-13 15:46:36
【问题描述】:
问题是当我添加一个组合链接时
<Route path="L1/L2" component={Comp}/>
导航到链接时,应用程序无法从公用文件夹加载资源,因为应用程序正在从示例加载资源:http://localhost:8080/L1/bundle.js 而不是 http://localhost:8080/bundle.js
我猜这是 webpack 配置中的问题,但无法修复
这是我的 webpack 配置:
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
}
所有帮助将不胜感激提前谢谢您!
【问题讨论】:
标签: reactjs webpack react-router