"Uncaught TypeError: r(...) is not a function" in a PixiJS app built with Webpack and deployed to Netlify

Viewed 119

I have developed a game project with PixiJS and built it with Webpack. On the localhost it works fine, but when I deploy it on Netlify, it shows the following error:

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)

I guess that there must be something wrong with the Webpack config. Here it is:


    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'
      })
    ]
    }

Here is the whole repository: https://github.com/EgorKorshunov/life-in-space In the src folder index.js is the main script file.

0 Answers
Related