Compile .vue file into .js file without webpack or browserify

后端 未结 1 1888
南方客
南方客 2020-12-31 09:45

Is there any way to compile .vue file into .js file without webpack or browserify? I know the goodness of webpack or browserify but I just want the simplest way to compile t

相关标签:
1条回答
  • 2020-12-31 10:25

    The vue-cli tool (version 2.8.0) has a build command that you can run to build an individual component.

    vue build Component.vue --prod --lib
    

    This will create an optimized bundle in UMD format, and the name of exported library is set to Component, you can use --lib [CustomLibraryName] to customize it.

    You can take the built script and include it in your file like you are in your question. Technically it does use webpack under the hood, but you do not have to configure anything.

    0 讨论(0)
提交回复
热议问题