. Advertisement .
..3..
. Advertisement .
..4..
When you attempt to run a project in Vue.js, the error “export ‘default’ (imported as ‘Vue’) was not found in ‘vue’” occurs and interrupts your work. How would this happen? And how do we fix it? We will answer those questions in the following part of this article.
How Does The Error “export ‘default’ (imported as ‘Vue’) was not found in ‘vue’” Occur?
In Vue version 2, Vue provides the default exports export default vue
to allow BooststrapVue to execute import Vue from 'vue
. The new version of Vue – Vue version 3, is no longer provides the default exports. Instead, it allows us to use named exports. So if you updated Vue to version 3, this error would be invoked in your work when bootstrap-Vue executes import Vue from 'vue
.
export 'default' (imported as 'Vue') was not found in 'vue'
That is the reason for this error appearance. Let’s continue reading to see the solutions for this error.
How To Solve The Error “export ‘default’ (imported as ‘Vue’) was not found in ‘vue’”?
METHOD 1: Update Vue Loader
Vue Loader is a web pack loader that permits you to author the components of Vue in a format called Single-File Components (SFCs).
If you want to use the latest version of Vue, you need to update Vue Loader. Upgrading Vue Loader to version 15.10.0 – the latest version, will help you to fix this error.
Run the command below in the terminal
npm i [email protected]
And the problem would be resolved.
METHOD 2: Downgrade Vue Version
Vue version 3.0 is relatively new, and many libraries have not caught up with this version. Our suggestion is to downgrade Vue to version 2. Despite the allowance of using BootstrapVue, this solution is preferred if you already have an enormous and complicated project using Vue 2. To downgrade the Vue version, you need to run the command as follows.
npm install vue@2
By using this command, npm will be able to replace the current installation of Vue with Vue version 2.6.14 and overwrite the existing Vue package.
Regardless of the advantages we just mentioned, you should still consider the pros and cons of using Vue’s latest or earlier version that we provide below.
- If you are working on a large and complex project that is currently using Vue 2. The performance gains may not be worth the migration effort.
- If you need support for IE11, avoid using Vue 3 because the support is not available in this version.
- Vue 3 is better at TypeScript compatibility than its previous versions.
- Use Vue 3 for the latest features if your dependencies are compatible with this version.
- Use Vue 3 if you often get into trouble after optimizing.
METHOD 3: Define Vue
To solve the error “export ‘default’ (imported as ‘Vue’) was not found in ‘vue,’” you just need to define Vue in your import. Just simply run the command as follows.
import * as Vue from 'vue'
We hope with the solutions we give you. You will fix this error successfully.
Conclusion
“Export ‘default’ (imported as ‘Vue’) was not found in ‘vue’” is an error that is invoked because Bootstrap-Vue executes the command import Vue from ‘vue. Above are three solutions that we found effective in resolving this error. Please leave comments below if you have any trouble while fixing this issue or have questions for us. Thank you for reading!
Read more:
Leave a comment