CartoDB / carto-react-template

CARTO for React. The best way to develop Location Intelligence (LI) Apps usign CARTO platform and React
https://sample-app-react.carto.com
MIT License
39 stars 26 forks source link

Compilation error: Can't resolve 'gl-matrix/mat3' #287

Closed julamb closed 3 years ago

julamb commented 3 years ago

Following the steps in Getting Started brings up this compilation error:

./node_modules/@math.gl/core/dist/esm/classes/matrix3.js
Module not found: Can't resolve 'gl-matrix/mat3' in '/Users/julien/workspace/tmp/carto-base-3/node_modules/@math.gl/core/dist/esm/classes'

yarn build shows a similar error.

I've tried yarn add gl-matrix-mat3 but the error remains. I have the same issue with the other templates (base-2 and sample-app-2).

julamb commented 3 years ago

I was able to work around the issue by adding the following entries to config.resolve.alias in config-overrides.js, not sure why this is needed though:

    "gl-matrix/common": path.resolve('./node_modules/gl-matrix/dist/esm/common.js'),
    "gl-matrix/mat2": path.resolve('./node_modules/gl-matrix/dist/esm/mat2.js'),
    "gl-matrix/mat2d": path.resolve('./node_modules/gl-matrix/dist/esm/mat2d.js'),
    "gl-matrix/mat3": path.resolve('./node_modules/gl-matrix/dist/esm/mat3.js'),
    "gl-matrix/mat4": path.resolve('./node_modules/gl-matrix/dist/esm/mat4.js'),
    "gl-matrix/quat": path.resolve('./node_modules/gl-matrix/dist/esm/quat.js'),
    "gl-matrix/quat2": path.resolve('./node_modules/gl-matrix/dist/esm/quat2.js'),
    "gl-matrix/vec2": path.resolve('./node_modules/gl-matrix/dist/esm/vec2.js'),
    "gl-matrix/vec3": path.resolve('./node_modules/gl-matrix/dist/esm/vec3.js'),
    "gl-matrix/vec4": path.resolve('./node_modules/gl-matrix/dist/esm/vec4.js')
borja-munoz commented 3 years ago

Hi, the only thing I see different is a new release of the gl-matrix package. Version 3.4.0 was published some hours ago and maybe math.gl needs to be updated as well.

borja-munoz commented 3 years ago

As suspected, it is a problem related to gl-matrix. Please take a look at this issue in the math.gl project.

julamb commented 3 years ago

You're right! Thank you very much :)