我遇到了一個問題,我正在將用戶重定向到相應的配置文件頁面,其中正在顯示配置文件信息。 我們以http://localhost:8080/user/1
爲例。 當我使用導航欄中的鏈接重定向用戶時,該頁面正在成功呈現,但在刷新同一網址中的頁面時(即http://localhost:8080/user/1
),我收到一條錯誤消息,說明找不到ERROR http://localhost:8080/user/bundle.js
。 我是新來的路由器v4請幫我解決這個問題。 在此先感謝。未找到bundle.js刷新頁面中有ID的頁面
我webpack.config.js是
var HtmlWebpackPlugin = require('html-webpack-plugin');
var webpack = require('webpack');
var path = require("path");
var config = {
entry: ["./src/index.tsx", 'webpack-dev-server/client?http://localhost:8080'],
plugins: [
new HtmlWebpackPlugin({
template: 'index.ejs',
filename: 'index.html'
}),
],
output: {
path: path.resolve(__dirname, "build"),
filename: "bundle.js"
},
resolve: {
extensions: [".ts", ".tsx", ".js"]
},
devtool: 'source-map',
module: {
rules: [
{ test: /\.tsx?$/, use: 'tslint-loader', enforce: 'pre' },
{ test: /\.tsx?$/, use: ['babel-loader', 'awesome-typescript-loader'] },
{ test: /\.(css|scss)$/, use: ['style-loader', 'css-loader', 'sass-loader'] },
{ test: /.(png|woff(2)?|eot|ttf|svg)(\?[a-z0-9=\.]+)?$/, use: 'url-loader?limit=1024&name=fonts/[name].[ext]' },
{ test: /\.(jpg|jpeg|gif|png)$/, use: 'url-loader?limit=10&mimetype=image/(jpg|jpeg|gif|png)&name=images/[name].[ext]' }
]
},
devServer: {
contentBase: path.join(__dirname, 'build'),
hot: true,
inline: true,
historyApiFallback: true
}
};
module.exports = config;
耶士它,但我從服務器獲取後存儲的實例在我的終極版商店的用戶ID 12。 –