vagran / dxf-viewer-example-src

Source for dxf-viewer-example GitHub pages repository
MIT License
47 stars 27 forks source link

webpack解析出错 #2

Closed LIKEADOGANDCAT closed 3 years ago

LIKEADOGANDCAT commented 3 years ago

./node_modules/dxf-viewer/src/DxfViewer.js 764:60 Module parse failed: Unexpected token (764:60) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders | | const material = materialFactory.call(this.viewer, this.viewer._TransformColor(color),

                                          instanceBatch?.GetInstanceType() ?? InstanceType.NONE)

| | let objConstructor

vagran commented 3 years ago

How did you get this error? Actually there are loaders configured here: https://github.com/vagran/dxf-viewer-example-src/blob/master/babel.config.js and here: https://github.com/vagran/dxf-viewer-example-src/blob/0b16e6fa5365b4896e0c03e26ed428fa27b4b91c/vue.config.js#L5 Running npm run build should work.

llcat commented 3 years ago

@LIKEADOGANDCAT yes, if you use dxf-viewer in your own project, you need add transpileDependencies in your webpack config file, because ?? is new operator in es2020

LIKEADOGANDCAT commented 3 years ago

How did you get this error? Actually there are loaders configured here: https://github.com/vagran/dxf-viewer-example-src/blob/master/babel.config.js and here:

https://github.com/vagran/dxf-viewer-example-src/blob/0b16e6fa5365b4896e0c03e26ed428fa27b4b91c/vue.config.js#L5

Running npm run build should work. My project is a React project,I 'm not sure it has a 'transpileDependencies',,,I think it's unique to VUE projects.Then what should I do to use dxf-viewer in my REACT(umi) project?

LIKEADOGANDCAT commented 3 years ago

fixed in a new react project :) 3q