首页 > 解决方案 > 尝试导入错误:“display”未从“pixi.js”导出(导入为“PIXI”)。在尝试部署时

问题描述

Attempted import error: 'display' is not exported from 'pixi.js' (imported as 'PIXI').

我正在尝试运行我的服务器,但弹出此错误。我做了一些研究,我应该在 webpack.config.js 中添加一些东西,但我似乎在我的任何文件夹中都找不到这个文件。我已经安装了一个 github 项目,所以我不太了解代码。

import React from 'react';
import * as PIXI from 'pixi.js';
import 'pixi-layers';
import{Viewport} from 'pixi-viewport';
import PropTypes from 'prop-types';
import SetType from 'es6-set-proptypes';

import { theme } from '../../../global-styles/variables';
import * as tableImage from '../../../assets/Path_33.png';

import * as s from './styles';

const appSecondary = parseInt(theme.appSecondary.slice(1), 16);

class FloorPlan extends React.PureComponent {
  constructor(props) {
    super(props);

    // use ref of parent div and use its width and height
    const { parent } = this.props;
    // Subtraction hack to fix the scrolling thing
    const width = parent.current.clientWidth - 10;
    const height = parent.current.clientHeight - 10;

    this.pixi = React.createRef();

    this.app = new PIXI.Application({
      width,
      height,
      transparent: false,
      antialias: true, // special filtering to look smoother
      resolution: 1 // for different screen resolutions/types
    });
    this.viewport = new Viewport({
      screenWidth: width,
      screenHeight: height,
      worldHeight: 1000,
      worldWidth: 1000,
      interaction: this.app.renderer.interaction,
      passiveWheel: false // presence of unnecessary passive event listeners causes a warning
    });
    this.app.renderer.backgroundColor = parseInt(theme.contentBackground.slice(1), 16);
    this.tables = [];
    this.texture = null;
    this.foreground = null;
    this.background = null;
    this.gridSize = 50;
  }

标签: pixi.js

解决方案


推荐阅读