Is it possible to share constants between react and node - I am running node and react concurrently? For example, I have some constants I've defined on the client side using export const that could be useful to have on the server side, but node gives me an error when I try to const {x} = require('./constants'); because it can't import correctly. Has anyone run into this problem and found a solution?
React Constants:
// constants.js
export const X = 'x';
export const Y = 'y';
export const Z = 'z';
// App.js
import {x, y, z} from './constants';
Node Constants:
// constants_node.js
module.exports.username = 'foo_user';
module.exports.id = 10;
// server.js
const {username, id} = require('./constants_node');