javascript - קבלת שגיאה "Void 0 אינו פונקציה" בדפדפן כאשר משתמשים ב-webpack לארוז קובץ TypeScript
אני משתמש ב-webpack עם גרסה 4.8.1 לארוז typescript שיש לה גרסה 2.8.1 אך כאשר אני משתמש בקובץ js הארוז בדפדפן אני מקבל שגיאה Void 0 is not function. הנה קובץ webpack.config.js שלי
var glob = require("glob")module.exports={
entry:{
LiveAgentApplication:"./Scripts/LiveAgent.Application.ts"
},output: {
path:__dirname+'/dist',
filename: '[name].bundle.js'
},module: {
rules: [
{ test: /\.ts$/, loader: 'ts-loader' }
]
},optimization: {
minimize: false
}}
הנה הקובץ tsconfig.js שלי
{
"compilerOptions": {
"target": "es5",
"module": "system",
"noImplicitAny": false,
"removeComments": true,
"preserveConstEnums": true,
"outFile": "../../built/local/tsc.js",
"sourceMap": true,
"allowJs": true,
"moduleResolution": "node"
},
"include": [
"./Scripts/*"
],
"exclude": [
"node_modules",
"**/*.spec.ts"
]}
ו-file package.json הוא כדלקמן:
{"name": "Resources",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"refreshVSToken ": "vsts-npm-auth -config .npmrc"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"geofluent-bundle": "^1.0.3",
"geofluent-chat-translation-bundle": "^1.0.2",
"geofluent-common-bundle": "^1.0.3",
"geofluent-itranslator-bundle": "^1.0.6",
"geofluent-sdk-bundle": "^1.0.1",
"geofluent-tokenizer-bundle": "^1.0.4",
"install": "^0.11.0",
"jquery": "^3.3.1",
"npm": "^5.8.0",
"ts-loader": "^4.2.0",
"webpack": "^4.8.1",
"webpack-cli": "^2.1.3",
"webpack-system-register": "^1.6.0",
},"devDependencies": {
"@types/jquery": "^3.3.1"
}}
הערה: חלק ממודולי הצומת שבהם אני משתמש מתארחים ברגיסטרי NPM הפרטי של הארגון שלנו