简体   繁体   English

react-scripts build:无法缩小此文件中的代码:opentok.js:1310

[英]react-scripts build: Failed to minify the code from this file: opentok.js:1310

I am getting a failed to minify the code error when building my react project using npm run build.使用 npm run build 构建我的 React 项目时,我无法缩小代码错误。

This is code that is causing the error.这是导致错误的代码。 Can anyone suggest what I could do to fix this?谁能建议我能做些什么来解决这个问题?

const createLogger = memoize(namespace => {
  /** @type Logger */
  const API = {};

  const setMethods = () => {
    Object.keys(logLevels).forEach(name => {
      const method = logLevels[name].method;
      const log = debug("OpenTok:" + namespace + ":" + name.toLowerCase());
      log.log = console[method].bind(console);
      API[name.toLowerCase()] = log;
    });
  };

  setMethods();
  return API;
});

My package.json我的 package.json

{
  "name": "react-basic-video-chat",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@opentok/client": "^2.17.0",
    "array.prototype.findindex": "^2.1.0",
    "opentok-react": "^0.10.0",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-router-dom": "^5.1.2",
    "react-scripts": "1.0.16"
  },
  "homepage": ".",
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}

My react-scripts package was out of date.我的 react-scripts 包已经过时了。 Installing the latest version fixed my problem.安装最新版本解决了我的问题。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM