Fix crash on ARM during rendering (#1077)

* chore: fix crash on ARM during rendering

Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>

* chore: remove useless comment

Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>

---------

Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
This commit is contained in:
Martin d'Allens 2023-11-26 02:16:33 +01:00 committed by GitHub
parent c9aa26a6de
commit 407f6b2e30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,12 +1,24 @@
'use strict';
// SECTION START
//
// The order of the two imports below is important.
// For an unknown reason, if the order is reversed, rendering can crash.
// This happens on ARM:
// > terminate called after throwing an instance of 'std::runtime_error'
// > what(): Cannot read GLX extensions.
import 'canvas';
import '@maplibre/maplibre-gl-native';
//
// SECTION END
import advancedPool from 'advanced-pool';
import fs from 'node:fs';
import path from 'path';
import url from 'url';
import util from 'util';
import zlib from 'zlib';
import sharp from 'sharp'; // sharp has to be required before node-canvas on linux but after it on windows. see https://github.com/lovell/sharp/issues/371
import sharp from 'sharp';
import clone from 'clone';
import Color from 'color';
import express from 'express';