The Event object is replaced with the object of vue

topic description

fastclick.js is used in the project to introduce vue and fastclick,FastClick.attach (document.body) into the entry file; the Event object is used in the source code, but inexplicably becomes a vue object, so an error of Cannot read property "stopImmediatePropagation" of undefined is reported

title code

entry js
import Vue from "vue"
import FastClick from" fastclick";
FastClick.attach (document.body);

webpack4 configuration
var path = require ("path");
var webpack = require (" webpack");
const HtmlWebpackPlugin = require ("html-webpack-plugin");
const {VueLoaderPlugin} = require (" vue-loader");
const MiniCssExtractPlugin = require ("mini-css-extract-plugin");
var appConfig = require (". / app.config.js");
var poxcyPath = appConfig.poxcyPath;
console.log (". /"+ poxcyPath)
const config = {

mode:process.env.NODE_ENV,
//mode: "development",
entry: {
    index: ["./src/index.js"]
}, // 
output: {
    path: path.resolve(__dirname, "./views"), // 
    publicPath: "./", // devServer
    filename: poxcyPath+"js/[name].js", // ,
    chunkFilename: poxcyPath+"js/[name].bundle.js",
},
resolve: {
    extensions: [".js", ".vue", ".json"],
    alias: {
        "vue$": "vue/dist/vue.esm.js", 
        "@": path.resolve(__dirname,"./src"),
    }
},    
module: {
    rules: [
        {
            test: /\.js$/,
            exclude: /node_modules/,
            loader: "babel-loader"
        },
        {
            test: /\.vue$/,
            exclude: /node_modules/,
            loader: "vue-loader",             
        },                      
        {
            test: /\.css$/,
            use: [ 
                process.env.NODE_ENV !== "production"
                ? "vue-style-loader": 
                {
                    loader:MiniCssExtractPlugin.loader,
                    options: { 
                        publicPath: "../" //
                    }
                },     
                "css-loader",               
            ]
        },
        {
            test: /\.less$/,
            use: [
                process.env.NODE_ENV !== "production"
                ? "vue-style-loader": 
                {
                    loader:MiniCssExtractPlugin.loader,
                    options: { 
                        publicPath: "../" //
                    }
                },                    
              "css-loader",
              "less-loader",
              "postcss-loader"
            ]
        },            
        {
            test:/\.(png|jpg|gif)$/,
            use:[{
                loader:"url-loader",
                options:{ // optionsbase64
                    limit:50000, // 50kbbase64,50kb
                    name: "images/[name].[hash:7].[ext]",
                }
            }]
        }
               
    ]
},
optimization: {
    splitChunks: {
      chunks: "all",
      cacheGroups: {
        //  node_modules 
        vendors: {
          test: /[\\/]node_modules[\\/]/,
          name: "vendors",
          chunks: "all",

        },
        commons: {
          // async 
          chunks: "async",
          name: "commons-async",
          /**
           * minSize  30000
           * 
           *  minSize
           */
          minSize: 0,
          //  chunks 
          minChunks: 2
        }
      }
    },
    /**
     *  minchunks: Infinity
     *  webpack 
     *  true  name
     */
    runtimeChunk: {
      name: "manifest"
    }
  }, 
plugins: [
    new HtmlWebpackPlugin({
        filename: "booking.html",
        template: path.resolve(__dirname,"./views/booking.html")
    }),
    new MiniCssExtractPlugin({
        // Options similar to the same options in webpackOptions.output
        // both options are optional
        filename: poxcyPath+"css/[name].css",
        chunkFilename: poxcyPath+"css/[id].css"
    }),        
    new VueLoaderPlugin(),
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NamedModulesPlugin(),
    new webpack.NoEmitOnErrorsPlugin(),
      
],
node: {

    setImmediate: false,
    // prevent webpack from injecting mocks to Node native modules
    // that does not make sense for the client
    dgram: "empty",
    fs: "empty",
    net: "empty",
    tls: "empty",
    child_process: "empty"
},    
devtool: process.env.NODE_ENV=="development"?"cheap-module-eval-source-map":"source-map",

};

module.exports = config

title picture

clipboard.png

clipboard.png

console.log (Event) normally pops up Event () {[native code]}, but now it becomes
Vue$3 {_ uid: 0, _ isVue: true, $options: {. }, _ renderProxy: Proxy, _ self: Vue$3,. }

Apr.07,2021

has been replaced in a module? You can first check the
entry js from keeping only this code

console.log(Event)
import Vue from 'vue'
import FastClick from 'fastclick'
FastClick.attach(document.body);

slowly add the original module to see if the referenced module modifies the global Event

I just tested that forcing the manual replacement of the global Event didn't trigger your error. That's amazing.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1be3ca4-52d43.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1be3ca4-52d43.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?