Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue-cli4版本的脚手架打包出来的js文件没有加hash #5589

Closed
orange-oss opened this issue Jun 17, 2020 · 2 comments
Closed

vue-cli4版本的脚手架打包出来的js文件没有加hash #5589

orange-oss opened this issue Jun 17, 2020 · 2 comments

Comments

@orange-oss
Copy link

IMPORTANT: Please use the following link to create a new issue:

https://new-issue.vuejs.org/?repo=vuejs/vue-cli

If your issue was not created using the app above, it will be closed immediately.

中文用户请注意:
请使用上面的链接来创建新的 issue。如果不是用上述工具创建的 issue 会被自动关闭。

@vue-bot
Copy link

vue-bot commented Jun 17, 2020

Hello, thank you for taking time filling this issue!

However, we kindly ask you to use our Issue Helper when creating new issues, in order to ensure every issue provides the necessary information for us to investigate. This explains why your issue has been automatically closed by me (your robot friend!).

I hope to see your helper-created issue very soon!


你好,你的 issue 不符合我们所要求的格式,因此已被自动关闭。为了确保每个 issue 都提供必需的相关信息,请务必使用我们的 Issue 向导 来创建新 issue,谢谢!

@vue-bot vue-bot closed this as completed Jun 17, 2020
@orange-oss
Copy link
Author

如题,
配置文件如下

    publicPath: '/',
    // 打包路径
    outputDir: 'dist',
    assetsDir: 'static',
    chainWebpack: config => {
        config.resolve.alias.set('@', resolve('src'))
        config.when(process.env.NODE_ENV !== 'DEV', config => {
            config
                .plugin('ScriptExtHtmlWebpackPlugin')
                .after('html')
                .use('script-ext-html-webpack-plugin', [
                    {
                        // `runtime` must same as runtimeChunk name. default is `runtime`
                        inline: /runtime\..*\.js$/
                    }
                ])
                .end()
            config.optimization.splitChunks({
                chunks: 'all',
                cacheGroups: {
                    libs: {
                        name: 'chunk-libs',
                        test: /[\\/]node_modules[\\/]/,
                        priority: 10,
                        chunks: 'initial' // only package third parties that are initially dependent
                    },
                    elementUI: {
                        name: 'chunk-elementUI', // split elementUI into a single package
                        priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
                        test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm
                    },
                    commons: {
                        name: 'chunk-commons',
                        test: resolve('src/components'), // can customize your rules
                        minChunks: 3, //  minimum common number
                        priority: 5,
                        reuseExistingChunk: true
                    }
                }
            })
            config.optimization.runtimeChunk('single')
        })
    },

我看官网文档说不是默认开启hash吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants