Ljgazzano
Ljgazzano

Reputation: 111

vue + vite + ubuntu 20 bugs

I'm very confused. I just saved my code to github from windows, where the vue.js app compiles successfully. But when opening exactly the same code in ubuntu, with the same versions of vite and vue, the app does not compile I receive multiple errors when trying to apply destructuring.

In auth.js i have:

const test = new Test(); export default {test}

And, in another file I call this

import {test} from '/auth.js'

I received this: No matching export in "src/auth.js" for import "test"

On windows everything works perfect. but when running "npm run dev" on Ubuntu I get this error.

I already tried: -remove node_modules -regenerate package-lock.json files -update versions

the versions of vite, vue, node and npm are exactly the same on windows and ubuntu. Some help?

Upvotes: 0

Views: 660

Answers (1)

Daniel Storey
Daniel Storey

Reputation: 943

You are exporting an object and attempting to destructure it when importing. However, this is the syntax for importing named exports and since you don't have a named export the error is occurring.

You should either do

export default test

import test from './auth.js'

Or

export { test }

import { test } from './auth.js'

Upvotes: 2

Related Questions