使用 webpack 捆绑 typescript 文件时在浏览器上出现错误“Void 0 is not function”

2024-03-28

我在用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"
]}

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 注册表上


None

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 webpack 捆绑 typescript 文件时在浏览器上出现错误“Void 0 is not function” 的相关文章

随机推荐