karol-f / vue-custom-element

Vue Custom Element - Web Components' Custom Elements for Vue.js
https://karol-f.github.io/vue-custom-element/
MIT License
1.97k stars 187 forks source link

Not clear how to use SFC on demos #190

Closed DiegoFleitas closed 4 years ago

DiegoFleitas commented 4 years ago

Im having trouble trying to use my Vue SFC's on Angular, every time I try to import the file containing the SFC I get the "Cannot use import statement outside a module" error, am I missing something?

karol-f commented 4 years ago

Why would You like to import SFC inside Angular app? It does not have vue-loader and will break.

Just create, in separate project, custom elements and build it so You will import already builded js files inside NG app.

Regards

DiegoFleitas commented 4 years ago

Hi, thanks for your response. We ended up using vue-loader on webpack to make this approach work https://github.com/alejox21/my-app

karol-f commented 4 years ago

Let me know if You will have other questions.

On the side note, personally, I won't mix Vue in NG project like that. It would be easier and more beneficial for developer to have separate vue-cli project and just grab JS files with already defined and build custom elements.

That way You just use e.g. <my-component> inside NG template and it will just work, without polluting NG project with Vue related stuff (like vue-loader).

But choose what suits You best. Regards!