Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import / export issue #215

Closed
vanderlin opened this issue Oct 29, 2016 · 1 comment
Closed

import / export issue #215

vanderlin opened this issue Oct 29, 2016 · 1 comment

Comments

@vanderlin
Copy link

Unable to use export in a index.js file when for example.

Here I have a index.js that exports the Bar component in say main.js I can not import bar from /bar. ie: import {Bar} from './components/bar'

/* in ./src/components/bar/index.js */
export Bar from './Bar.vue'



/* in ./src/components/bar/Bar.vue */
<template>
   <div>Hi</div>
</template>

export default {
}

<style>
</style>

I get this error?

ERROR in ./src/components/bar/index.js
Module build failed: SyntaxError: Unexpected token, expected { (1:7)

> 1 | export Bar from './Bar'
    |        ^
@zigomir
Copy link
Contributor

zigomir commented Oct 30, 2016

@vanderlin this is not a vue-cli issue. Also, as error tells you, I think correct ES6 syntax for re-export would be something like:

export { Bar } from './Bar'

See more here under Re-exporting section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants