pissang / clay-viewer

3D model viewer with high quality rendering and glTF2.0/GLB export
https://pissang.github.io/clay-viewer/editor/
BSD 3-Clause "New" or "Revised" License
771 stars 97 forks source link

Unable to build QMV.js #3

Closed cx20 closed 6 years ago

cx20 commented 6 years ago

I tried the following command.

npm install
npm run build

However, an error occurred.

C:\home\edu\javascript\library\qtek-model-viewer-master>npm run build

> qtek-model-viewer@0.1.0 build C:\home\edu\javascript\library\qtek-model-viewer-master
> npm run glsl2js && rollup -c && uglifyjs -c -m -- dist/QMV.js > dist/QMV.min.js

> qtek-model-viewer@0.1.0 glsl2js C:\home\edu\javascript\library\qtek-model-viewer-master
> node build/glsl2js.js

C:\home\edu\javascript\library\qtek-model-viewer-master/index.js → dist/QMV.js...
[!] Error: 'default' is not exported by node_modules\zrender\lib\core\util.js
https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module
src\Viewer.js (23:7)
21: import SceneHelper from './graphic/SceneHelper';
22: import defaultSceneConfig from './defaultSceneConfig';
23: import zrUtil from 'zrender/lib/core/util';
           ^
24:
25: import getBoundingBoxWithSkinning from './util/getBoundingBoxWithSkinning';

The environment used for the build is the Windows 10 command prompt. I also tried Bash on Windows, but the result was an error similar to the previous one.

How can I create the latest version of QMV.js?

pissang commented 6 years ago

It's because one of the dependencies zrender has just changed from CommonJS modules to ES6 modules in the latest version. Already fixed in https://github.com/pissang/qtek-model-viewer/commit/8fdee5be90846577a89965ff18576118c8095e26

BTW if you want to build the code by yourself, it is suggested that clone the latest code of qtek and put it under the node_modules.

cx20 commented 6 years ago

@pissang I built it according to your advice and it worked. Thanks!