surveyjs / survey-library

Free JavaScript form builder library with integration for React, Angular, Vue, jQuery, and Knockout.
https://surveyjs.io/form-library
MIT License
4.18k stars 808 forks source link

Surveyjs-vue not working with last vue cli #1223

Closed xibman closed 6 years ago

xibman commented 6 years ago

Are you requesting a feature, reporting a bug or asking a question?

Bug

What is the current behavior?

universalModuleDefinition?2436:1 Uncaught TypeError: Cannot read property 'Vue' of undefined

How would you reproduce the current behavior (if this is a bug)?

Just simply use the surveyjs_vue_quickstart to use surveyjs

Specify your

tsv2013 commented 6 years ago

@xibman Are you talking about not released yet version (v3.0.0-beta.8) or stable (2.9.x) version?

xibman commented 6 years ago

the released version v3.0.0-rc.3

tsv2013 commented 6 years ago

I've updated vue-cli via the "npm i vue-cli" command and got the 2.9.6 version of the vue-cli

xibman commented 6 years ago

i use npm install -g @vue/cli

tsv2013 commented 6 years ago

thanks for the info

tsv2013 commented 6 years ago

I've just updated node.js to 8.11.3, @vue/cli to v3.0.0-rc.3, cloned the https://github.com/surveyjs/surveyjs_vue_quickstart repo, run "npm i" and run "npm run dev" - everything works ok for me

Am I missing something?

xibman commented 6 years ago

Sorry you missing nothing, is my fault i did not explain all the process.

  1. instal vue cli v3.0.0-rc3 as you done
  2. create a new project with vue cli and default preset : vue create test-survey
  3. Add survey lib and try to instanciate a form
xibman commented 6 years ago

I think the problem came from webpack. You use webpack 2 to build surveys js project and the new vue-cli use webpack 4

tsv2013 commented 6 years ago

After investigations we find out that the problem is in the library name :-) Folder "survey-vue" in "node_modules" with main file "survey.vue.js" is not working, but folder "survey-vu" in "node_modules" with main file named "survey.vu.js" is working ok :-)

tsv2013 commented 6 years ago

@xibman Can you help us localize the problem with the @vue/cli? What causes the issue - vue-loader or loader plugin or something else...

xibman commented 6 years ago

I will try to find @tsv2013

kamidev commented 6 years ago

I have the same kind of problems as @xibman. Will take a look again when surveyjs 1.0.33 is out.

Note that @vue/cli is now at v3.0.0-rc.5 and more updates may be coming soon.

xibman commented 6 years ago

Same problem with latest version of vue-cli and survey-vue

kamidev commented 6 years ago

Same here - still doesn't work with the latest versions. Would it be hard to change the problematic filename, if upstream doesn't fix the root cause?

dmitry-kurmanov commented 6 years ago

@kamidev we've created an issue in vue/cli repo (see the reference above). We believe that project functionality shouldn't depend on file names.

kamidev commented 6 years ago

@dmitrykurmanov I saw your issue and I agree. Let's hope for the best!

kamidev commented 6 years ago

Perhaps the ".vue" part of the name is misinterpreted as a file extension? For instance, vue-loader does look for extensions in order to parse Single File Components. That would explain this behavior.

xibman commented 6 years ago

it could be the solution : https://vue-loader.vuejs.org/migrating.html#importing-sfcs-from-dependencies

tsv2013 commented 6 years ago

@xibman Yes, it could. But peolpe should to know it when starting from scratch... It's a kind of magic :-)

kamidev commented 6 years ago

Yes, it is an unfortunate kind of magic. :-)

But even @yyx990803 himself says: ".vue.js is the special file extension used by vue-loader to match against Githubissues.

  • Githubissues is a development platform for aggregating issues.