简体   繁体   English

错误 - [webpack] 'dist':来自 UglifyJs 的 list-documents-web-part.js 意外令牌:名称(样式)[list-documents-web-part.js:73666,7]

[英]Error - [webpack] 'dist': list-documents-web-part.js from UglifyJs Unexpected token: name (style) [list-documents-web-part.js:73666,7]

I have an application in SPFX.我在 SPFX 中有一个应用程序。 After installing and started to use a jQuery Datatable component, I get the following error on gulp bundle:安装并开始使用 jQuery 数据表组件后,我在 gulp 捆绑包上收到以下错误:

Error - [webpack] 'dist':
list-documents-web-part.js from UglifyJs
Unexpected token: name (style) [list-documents-web-part.js:73666,7]

This issue only happen when I use Datatables.此问题仅在我使用数据表时发生。 I have read that this problem was, that I had npm packages, that uses ES6 code, and UglifyJS wasn't able to compile ES6, but I still haven't figured out how to fixed it.我读过这个问题是,我有 npm 包,它使用 ES6 代码,而 UglifyJS 无法编译 ES6,但我还没有弄清楚如何修复它。

package.json package.json

{
  "name": "solution-nf-se",
  "version": "0.0.1",
  "private": true,
  "main": "lib/index.js",
  "scripts": {
    "build": "gulp bundle",
    "clean": "gulp clean",
    "test": "gulp test"
  },
  "dependencies": {
    "@microsoft/sp-core-library": "~1.4.0",
    "@microsoft/sp-lodash-subset": "~1.4.0",
    "@microsoft/sp-office-ui-fabric-core": "~1.4.0",
    "@microsoft/sp-webpart-base": "~1.4.0",
    "@pnp/common": "^1.3.7",
    "@pnp/logging": "^1.3.7",
    "@pnp/odata": "^1.3.7",
    "@pnp/sp": "^1.3.7",
    "@types/datatables.net": "^1.10.20",
    "@types/jqueryui": "^1.12.15",
    "bootstrap": "^4.6.0",
    "datatables.net": "^1.11.1",
    "datatables.net-jqui": "^1.11.1",
    "jquery": "^3.6.0",
    "jqueryui": "^1.11.1",
    "moment": "2.27.0"
  },
  "devDependencies": {
    "@fortawesome/fontawesome-free": "^5.15.3",
    "@microsoft/sp-build-web": "~1.4.1",
    "@microsoft/sp-module-interfaces": "~1.4.1",
    "@microsoft/sp-webpart-workbench": "~1.4.1",
    "@types/bootstrap": "^4.6.0",
    "@types/jquery": "^3.5.5",
    "@types/webpack-env": "1.13.1",
    "ajv": "~5.2.2",
    "gulp": "~3.9.1",
    "url-loader": "^4.1.1",
    "webpack": "^3.6.0"
  }
}

gulpfilee.js gulpfilee.js

"use strict";

const gulp = require("gulp");
const build = require("@microsoft/sp-build-web");

build.addSuppression(
  `Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`
);
build.configureWebpack.mergeConfig({
  additionalConfiguration: generatedConfiguration => {
    generatedConfiguration.module.rules.push({
      test: /\.woff2(\?v=[0-9]\.[0-9]\.[0-9])?$/,
      use: {
        loader: "url-loader", query: { limit: 10000, mimetype: 'application/font-woff2'}
      }
    });
    return generatedConfiguration;
  }
});


build.initialize(gulp)

Can somebody help me to solve it?有人可以帮我解决吗?

Yes, I have got the same error, and I have tried this using this:-是的,我遇到了同样的错误,我已经尝试过使用这个:-

https://github.com/SharePoint/sp-dev-docs/issues/2782 https://github.com/SharePoint/sp-dev-docs/issues/2782

Maybe you can solve this issue.也许你可以解决这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 来自UglifyJs的bundle.js中的webpack错误-ERROR意外的令牌:name(urlParts) - webpack error -ERROR in bundle.js from UglifyJs Unexpected token: name (urlParts) webpack 2:来自UglifyJs的./public/bundle.js中出现错误意外字符'`' - webpack 2: ERROR in ./public/bundle.js from UglifyJs Unexpected character '`' UglifyJS的bundle.js中出现意外的令牌名称“ i”,预期的点是“;” - Unexpected token name «i», expected punc «;» Error in bundle.js from UglifyJS 来自 UglifyJs 的 build.js 中的错误意外标记:punc (() - ERROR in build.js from UglifyJs Unexpected token: punc (() 来自 UglifyJs SyntaxError 的 bundle.js 中的错误:意外令牌:名称(处理程序) - ERROR in bundle.js from UglifyJs SyntaxError: Unexpected token: name (Handler) Webpack UglifyJS运行到意外令牌中 - Webpack UglifyJS running into unexpected token 来自 UglifyJs 的错误:SyntaxError:意外标记:运算符(>) - ERROR from UglifyJs: SyntaxError: Unexpected token: operator (>) UglifyJs意外令牌错误 - UglifyJs unexpected token error 查询 object 并返回 `_id` 字段不属于列表的嵌入文档 - Query object and return embedded documents that the `_id` field is not part of a list UglifyJS webpack 插件抛出:意外的令牌:名称(功能) - UglifyJS webpack plugin throws: Unexpected token: name (features)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM