remove need for babel register in clientside

This commit is contained in:
Matteo Pagliazzi 2019-10-02 23:19:24 +02:00
parent e021328067
commit 5b406ba70f
4 changed files with 8 additions and 8 deletions

View file

@ -1,4 +1,4 @@
const nconf = require('nconf');
import nconf from 'nconf';
const IS_PROD = nconf.get('IS_PROD');
const STACKDRIVER_TRACING_ENABLED = nconf.get('ENABLE_STACKDRIVER_TRACING') === 'true';

View file

@ -1,10 +1,10 @@
// require allows import from webpack
// NOTE es5 requires/exports to allow import from webpack
const nconf = require('nconf');
const { join, resolve } = require('path');
const PATH_TO_CONFIG = join(resolve(__dirname, '../../../config.json'));
export default function setupNconf (file) {
module.exports = function setupNconf (file) {
let configFile = file || PATH_TO_CONFIG;
nconf
@ -15,4 +15,4 @@ export default function setupNconf (file) {
nconf.set('IS_PROD', nconf.get('NODE_ENV') === 'production');
nconf.set('IS_DEV', nconf.get('NODE_ENV') === 'development');
nconf.set('IS_TEST', nconf.get('NODE_ENV') === 'test');
}
};

View file

@ -5,7 +5,7 @@ import {
BadRequest,
NotAuthorized,
} from '../../libs/errors';
import { model as User } from '../../models/user';
import { model as User, schema as UserSchema } from '../../models/user';
import {nameContainsSlur} from './validation';
@ -61,7 +61,7 @@ const updatablePaths = [
// This tells us for which paths users can call `PUT /user`.
// The trick here is to only accept leaf paths, not root/intermediate paths (see http://goo.gl/OEzkAs)
let acceptablePUTPaths = _.reduce(require('./../../models/user').schema.paths, (accumulator, val, leaf) => {
let acceptablePUTPaths = _.reduce(UserSchema.paths, (accumulator, val, leaf) => {
let found = _.find(updatablePaths, (rootPath) => {
return leaf.indexOf(rootPath) === 0;
});

View file

@ -2,8 +2,8 @@ import mongoose from 'mongoose';
import schema from './schema';
require('./hooks');
require('./methods');
import './hooks';
import './methods';
// A list of publicly accessible fields (not everything from preferences because there are also a lot of settings tha should remain private)
export let publicFields = `preferences.size preferences.hair preferences.skin preferences.shirt