Getting error “Void 0 is not function” on browser when using webpack to bundle typescript file

依然范特西╮ 提交于 2019-12-12 18:47:00

问题


I am using webpack with 4.8.1 version to bundle typescript which has 2.8.1 version but when i am using that bundled js on browser i am getting error Void 0 is not function.here is my webpack.config.js file

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
  }}

Here is my 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"
]}

And package.json is as follows:

{"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"
}}

Note:some of the node modules i am using are hosted on our organization's private NPM registry

来源:https://stackoverflow.com/questions/50352402/getting-error-void-0-is-not-function-on-browser-when-using-webpack-to-bundle-t

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!