javascript - 使用 Webpack 构建并部署到 Netlify 的 PixiJS 应用程序中的“未捕获的 TypeError:r(...) 不是函数”
问题描述
我用 PixiJS 开发了一个游戏项目,并用 Webpack 构建了它。在本地主机上它工作正常,但是当我在 Netlify 上部署它时,它显示以下错误:
VM867 index.js:2 Uncaught TypeError: r(...) is not a function
at Object.6168 (VM867 index.js:2)
at r (VM867 index.js:2)
at Object.7912 (VM867 index.js:2)
at r (VM867 index.js:2)
at Object.5474 (VM867 index.js:2)
at r (VM867 index.js:2)
at Object.5173 (VM867 index.js:2)
at r (VM867 index.js:2)
at Object.7042 (VM867 index.js:2)
at r (VM867 index.js:2)
我想 Webpack 配置一定有问题。这里是:
const path = require('path')
const HtmlPlugin = require('html-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const ImageminPlugin = require('imagemin-webpack-plugin').default
module.exports = {
context: path.join(__dirname, 'src'),
entry: ['./index.js'],
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'index.js',
},
module: {
rules: [
{
test: /\.(css)$/,
use: ['style-loader','css-loader']
}
]
},
target: 'web',
plugins: [
new CopyWebpackPlugin({
patterns: [
{ from: 'img/',to:'assets/'}
]}),
new ImageminPlugin({
test: /\.(jpe?g|png|gif|svg)$/i ,
pngquant: {
verbose:true,
quality: '80-90',
}
})
,new HtmlPlugin({
file:path.join(__dirname,'dist','index.html'),
template:'./index.html'
})
]
}
这是整个存储库:https://github.com/EgorKorshunov/life-in-space 在 src 文件夹中 index.js 是主脚本文件。
解决方案
推荐阅读
- javascript - How to bypass the pointless checking array.filter
- c# - Visual Studio 8.0 for Mac 无法显示/编辑 .cs 文件
- c++ - 如果我通过通用引用接受参数,is_rvalue_reference 和 is_lvalue_reference 中的一个是否为真?
- c# - 有没有办法为 OAuthPrompt Dialog 配置代理身份验证?
- mysql - 如何知道一组日期范围是否涵盖更大的日期范围?
- ios - 如何根据在前一个控制器中点击的单元格在视图控制器上呈现数据
- animation - 铁拳 3 电影介绍是如何创建的(使用的软件、流程、效果...等)?
- jupyter-notebook - 找不到 IPython 魔术扩展
- r - 如何用括号提取化学式中每个元素的数量,并将它们创建成列?
- javascript - 如何打印从 $_POST 从 javascript 传输到 php 的数组