Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

299
Views
How can I select between multiple different variants of an import statement in javascript?

If javascript had a 'C like' preprocessor, what I want to do would look like this...

#define LOCAL
#if LOCAL
import * as THREE from '../three.js'
import { GUI } from '../three.js/examples/jsm/libs/dat.gui.module'
import { TWEEN } from '../three.js/examples/jsm/libs/lil-gui.module.min.js'
import * as BufferGeometryUtils from '../three.js/examples/jsm/utils/BufferGeometryUtils.js'
#elif
// Use for website
import * as THREE from 'https://cdn.skypack.dev/three@0.133.1/build/three.module.js'
import { GUI } from 'https://cdn.skypack.dev/three@0.138.1/examples/jsm/libs/lil-gui.module.min.js'
import { TWEEN } from 'https://cdn.skypack.dev/three@0.133.1/examples/jsm/libs/tween.module.min'
import * as BufferGeometryUtils from 'https://cdn.skypack.dev/three@0.133.1/examples/jsm/utils/BufferGeometryUtils.js'
#endif

Basically, I want to minimize the amount of editing that I need to do across all of my project's files when I switch from a locally hosted webserver to my website's webserver.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!