Skip to content

Instantly share code, notes, and snippets.

@bjszd
Created September 22, 2021 09:38
Show Gist options
  • Save bjszd/1d121a71e2174e848c4d9f5a2e234019 to your computer and use it in GitHub Desktop.
Save bjszd/1d121a71e2174e848c4d9f5a2e234019 to your computer and use it in GitHub Desktop.
Example of webpack conditional import
import aear from './ar-AE.json';
import bhar from './ar-BH.json';
// eslint-disable-next-line no-undef
const market = process.env.MARKET;
let polyfillData: typeof aear;
if (market === 'ae/ar') {
polyfillData = aear;
}
if (market === 'bh/ar') {
polyfillData = bhar;
}
export default polyfillData;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment