nuxt-community / express-template

Starter template for Nuxt 2 with Express.
https://codesandbox.io/s/github/nuxt-community/express-template
1.25k stars 239 forks source link

Module exports #112

Closed zakanybalazs closed 6 years ago

zakanybalazs commented 6 years ago

Hi I have already tried many ways of doing this, but always get the same error:

@/accessers/ac_user.js

import fireconf from '~/firebase_conf.json';

module.exports = {
  User: (type, value) => {
    switch (type) {
      case 'uid':
        return axios.get(fireconf.getuser.uid.url);
      case 'email':
        return axios.get(fireconf.getuser.email.url);
    }
  }
}

Index.vue

import {User} from '@/accessers/ac_user.js';

nuxt.config.js

  modules: [
    '~/accessers/ac_user.js'
  ],

Also I have included in package.json the "babel-polyfill", because that's supposed to help. (it didn't)

Am I missing something?

This question is available on Nuxt.js community (#c92)