nativescript-dev-webpack icon indicating copy to clipboard operation
nativescript-dev-webpack copied to clipboard

ERROR: VueRouter is not a constructor

Open zbranzov opened this issue 6 years ago • 1 comments

Environment Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 5.3

  • Cross-platform modules: 5.3

  • Android Runtime:5.3

  • iOS Runtime: 5.3

  • Plugin(s): https://github.com/nativescript-vue/nativescript-vue/blob/867e5f8f7f7433cb10d5445946c16a3b15161a49/samples/package.json

  • Node.js: v10.12.0

  • [x] Please, attach your package.json and webpack.config.js as these configurations are usually critical for investigating issues with webpack

  • Default generated webpack.config.js as of dev-webpack 0.21

Describe the bug Trying to builds the app in 'samples' folder of https://github.com/nativescript-vue/nativescript-vue/tree/867e5f8f7f7433cb10d5445946c16a3b15161a49 using bundle flag cause the error above.

Expected behavior Be able to build the app

Sample project https://github.com/nativescript-vue/nativescript-vue/tree/867e5f8f7f7433cb10d5445946c16a3b15161a49/samples

Additional context Adding mainFields: ['main', 'module'] to the webpack.config seems to fix it but in that case we should commit the file

zbranzov avatar Apr 22 '19 10:04 zbranzov

Hi @zbranzov, I managed to reproduce the described error with the sample app but I think the issue is with vue-router itself. There are issues logged in the vue-router repo which described the same problem and couple of workarounds. In my app I imported the VueRouter that way: import VueRouter from 'vue-router' or const VueRouter = require('vue-router').default and I was able to build and deploy the app. Can you please try if that will fix the issues on your side too.

endarova avatar May 20 '19 06:05 endarova