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

关于webpack配置 #144

Open
ckinmind opened this issue Sep 27, 2017 · 1 comment
Open

关于webpack配置 #144

ckinmind opened this issue Sep 27, 2017 · 1 comment
Labels

Comments

@ckinmind
Copy link
Owner

ckinmind commented Sep 27, 2017

配置清单

    1. 文件每次构建后自动更新(加入hash值)
@ckinmind
Copy link
Owner Author

ckinmind commented Sep 27, 2017

1. 配置异步加载文件的hash值,以便重新构建后不需要清除浏览器缓存来使文件生效

output: {
    path: path.join(__dirname, 'dist'),   // path配置只在build时才有用到
    filename: '[name].js',
    chunkFilename: '[name].[chunkhash:8].js',   // 给js文件加上chunkhash值  
   // ...
  },

chunkFilename中加入chunkhash

参考资料:Webpack中hash与chunkhash的区别,以及js与css的hash指纹解耦方案

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

No branches or pull requests

1 participant