pixi.js - 尝试导入错误:“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;
}
解决方案
推荐阅读
- javascript - 在对象数组中对数组进行排序
- javascript - JS 对象数组 - 删除重复并合并嵌套对象
- javascript - Electron interceptBufferProtocol 代理请求不起作用
- r - JAGS 中可能的定向循环
- javascript - 如何使用 CSS 或 JS 将块元素的工具提示居中?
- spring-boot - 尝试运行基于 maven 的简单 springboot 项目时出错
- python - 当应用程序有多个调用时,日志配置无法加载 value-formatter()
- javascript - 在模态弹出窗口中显示单击项目的内容
- excel - 调用 Excel Office.js 自定义函数时如何隐藏开发者窗口
- curl - 如何卷曲这个 HTML 表单?