[Vuejs]-Using `.vue` files with latest browsers that support import/export

2👍

As said in the comment, even modern browsers are unable to read .vue files, and that’s very unlikely to change in the future. So you should should use some build tool to convert .vue to .js. For bundle solutions, see the other answers.

If for some reason you don’t want to bundle them (the only serious reason I can see for it is for fun & test / pure electron release, actually, but anyway), I may have another solution.

I didn’t tested it for your particular use case (native import/export in browser), but I wrote a module using vueify to convert .vue files into .js, without bundling them, using gulp. It should probably work.

1👍

In order to process .vue files you need vue-loader or vueify, which essentially turns them into a js object for you to import. They’re built specifically for use with webpack and browserify so you need to use one of those to use .vue files.

I know you said you don’t like the overhead but the vue-cli webpack template can have you going in minutes.

Leave a comment