Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
517 views
in Technique[技术] by (71.8m points)

vue.js - Vue-CLI: Remove '.umd' from filename in dist folder

I'm generating a library with Vue CLI 4.4:

vue-cli-service build --target lib --formats=umd,umd-min --name example main.js

As a result, I get a number of files in the dist folder:

  • example.umd.js
  • example.umd.min.js
  • ...

I'd like to remove the .umd from the file name. How to accomplish that?

I've tried the following two things in my vue.config.js, but it did not help:

    configureWebpack: {
        output: {
            filename: 'example.js',
            chunkFilename: 'example.[name].js'
        }
    }
    chainWebpack: config => {
        config.output.filename('example.js')
        config.output.chunkFilename('example.[name].js')
    }

It seems vue-cli sets this "postfix" here: https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-service/lib/commands/build/resolveLibConfig.js#L140 Unfortunately, I can't figure out how to override it without forking the whole project.

question from:https://stackoverflow.com/questions/66050863/vue-cli-remove-umd-from-filename-in-dist-folder

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...