diff --git a/imports/startup/server/calcUnionAsync.js b/imports/startup/server/calcUnionAsync.js index 6e00c03..0eaa57f 100644 --- a/imports/startup/server/calcUnionAsync.js +++ b/imports/startup/server/calcUnionAsync.js @@ -1,6 +1,16 @@ import path from 'path'; import { Worker } from 'worker_threads'; +// Meteor only bundles the npm packages it sees imported/required somewhere in +// its own compiled module graph. The actual usage of these three is inside +// private/workers/unionWorker.js, a plain asset file Meteor's bundler never +// traces (it's loaded at runtime via new Worker(), not import/require here). +// Without this, `meteor build` drops them from programs/server/node_modules +// and the worker fails at startup with "Cannot find module '@turf/circle'". +import '@turf/circle'; +import '@turf/union'; +import '@turf/truncate'; + const WORKER_PATH = path.resolve(process.cwd(), 'assets/app/workers/unionWorker.js'); /**