【发布时间】:2017-12-08 06:33:12
【问题描述】:
我不断收到Cannot GET /task 我试图用我在这里找到的解决方案修改我的 webpack,但我仍然明白。
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: './src/app.js',
output: {
path: __dirname + '/dist',
filename: 'app.bundle.js'
},
module: {
rules: [
{
test: /\.s?css$/,
use: ['style-loader', 'css-loader', 'sass-loader']
}, {
test: /\.js$/,
exclude: /node_modules/,
use: 'babel-loader'
}, {
test: /\.(ttf|otf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/,
loader: 'file-loader?name=fonts/[name].[ext]'
}
]
},
devServer: {
historyApiFallback: {
index: '/index.html'
},
stats: true,
inline: true,
progress: true
}
plugins: [new HtmlWebpackPlugin({template: './src/index.html'})]
}
【问题讨论】:
-
您在运行 devServer 时遇到此错误?
-
@YuriRamos 不知道我的网址是否类似于“localhost:8080”。我点击一个按钮,它转到“localhost:8080/grades”。如果我在我的解决方案中进行更改,开发服务器将重新呈现页面,这就是我得到它的时候。
标签: reactjs webpack react-router webpack-2