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

TypeError: Vue is not a constructor #5470

Closed
adyz opened this issue Apr 19, 2017 · 6 comments
Closed

TypeError: Vue is not a constructor #5470

adyz opened this issue Apr 19, 2017 · 6 comments

Comments

@adyz
Copy link

adyz commented Apr 19, 2017

Version

2.2.6

Reproduction link

https://jsbin.com/domunix/edit?html,js,output

Steps to reproduce

I was using Vue 2.1.8 with webpack2 and loading vue in my backbone router with require.ensure function provided by webpack for code splitting.

require.ensure([], function(){
            window.Vue = require('vue');
});

This allowed be to load Vue library only for the routes I needed, but since I've updated to 2.2.6 I get TypeError: Vue is not a constructor in the browser.

What is expected?

To build as before

What is actually happening?

TypeError: Vue is not a constructor


Using import Vue from 'vue' will not help since I want the Vue library to be loaded on demand. Is there any ways to achieve this.

@posva
Copy link
Member

posva commented Apr 19, 2017

Please provide a real repro

@adyz
Copy link
Author

adyz commented Apr 19, 2017

@posva thank you for your answer, but I am not sure where can I find a proper place to write code that will run webpack and build files... any links/services you use?

@posva
Copy link
Member

posva commented Apr 19, 2017

You can add a repository, but make sure to boil it down to the strict minimum, please

@adyz
Copy link
Author

adyz commented Apr 19, 2017

Hope this is fine: https://github.com/adyz/vuejs-backbone

@adyz
Copy link
Author

adyz commented Apr 19, 2017

This is the old version that used to work: https://github.com/adyz/vuejs-backbone/tree/oldvue

@adyz
Copy link
Author

adyz commented Apr 19, 2017

Ow shit, I guess it was all about the alias in webpack.config.js file added on the oldvue branch

resolve: {
        alias: {
            'vue': 'vue/dist/vue.js'
        }
    }

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

No branches or pull requests

2 participants