Edit This was marked as a duplicate of a question that has no useable answers. Here's how I addressed it:
var BASE = 'http://localhost:3001/'
export let {BASE_URL, LOGIN_URL, LOGIN_USER, LOGOUT_USER} = {
BASE_URL: BASE,
LOGIN_URL: BASE + 'sessions/create',
SIGNUP_URL: BASE + 'users',
LOGIN_USER: 'LOGIN_USER',
LOGOUT_USER: 'LOGOUT_USER'
}
Original question I am exploring some React code from here. It has an npm script to browserify it which is:
"browserify --extension=.jsx --extension=.js src/app.jsx | uglifyjs > build/build.js"
However I cannot run this as it just freaks out on the ES6 code. I am not sure what setup the authors had. So I changed mine to:
"browserify --extension=.jsx --extension=.js src/app.jsx \
-t [ babelify --presets [ es2015 react ] ] | uglifyjs > build/build.js"
This now builds "fine" except that code that is exported using exports default
is undefined as in a file that contains:
var BASE_URL = 'http://localhost:3001/'
export default {
BASE_URL: BASE_URL,
LOGIN_URL: BASE_URL + 'sessions/create',
SIGNUP_URL: BASE_URL + 'users',
LOGIN_USER: 'LOGIN_USER',
LOGOUT_USER: 'LOGOUT_USER'
}
In the file that imports it:
import { LOGIN_URL, SIGNUP_URL } from '../constants/LoginConstants'
The LOGIN_URL
and SIGNUP_URL
are undefined.
Any idea what is happening?