我有一个带有 React/webpack 前端和 Django/python 后端的应用程序。它过去已成功部署到 heroku。自从我在应用程序中做任何事情以来已经有一段时间了,在最近的一些更新之后,我想更新已部署的版本。Heroku 报告应用程序部署成功,但当我尝试访问它时,出现错误:
拒绝执行来自 'https://pairshead-2020.herokuapp.com/bundle.js' 的脚本,因为其 MIME 类型 ('text/html') 不可执行,并且启用了严格的 MIME 类型检查。
这是我的 webpack.config.js:
const path = require('path')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
entry: './src/app.js',
context: path.resolve(__dirname, 'frontend'),
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'frontend/dist'),
publicPath: '/'
},
devtool: 'source-maps',
module: {
rules: [
{ test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/ },
{ test: /\.css$/, loader: ['style-loader', 'css-loader'] },
{ test: /\.s(a|c)ss$/, loader: ['style-loader', 'css-loader', 'sass-loader'] },
{ test: /\.woff2?$/, …Run Code Online (Sandbox Code Playgroud)