vuejs / rollup-plugin-vue

Roll .vue files
https://vuejs.github.io/rollup-plugin-vue
MIT License
846 stars 148 forks source link

Cant import javascript or other vue files into vue single file components #460

Open DanielTerletzkiy opened 2 years ago

DanielTerletzkiy commented 2 years ago

Version

5.0.0

Reproduction link

github.com

Steps to reproduce

open vue file, in script tag make an import to any file (vue, js, etc), compile and open project where you use the compiled plugin

What is expected?

rollup compiles everything into a single file and handles all imports accordingly

What is actually happening?

imports are still inside of compiled file, leading nowhere

Example: Could not find module in path: 'vuelize/dist/src/mixins/flex' relative to '/node_modules/vuelize/dist/vuelize.esm.js'

flex was a js file imported in one of the now compiled vue components


i first noticed the problem while making recursive vue components, wich is, as of now, not achievable for me, because it requires the same vue file to be imported again to declare it inside the components. The import exists inside the compiled file, leading to nowhere and "crashing" the app with something like this:

Could not find module in path: 'vuelize/dist/src/mixins/flex' relative to '/node_modules/vuelize/dist/vuelize.esm.js'

i also tried decaring the source folder in the package.json, but then i dont have any way of reasonably importing, for both prod and dev, as prod esm.js files cant handle @ or~ imports