扫码关注官方订阅号
我使用webpack构建时 想要把hash值存到全局变量中 其他模块的js可以调用到。试着配了下 只有放到文件名中 比如output: 'a[hash].js'才有效果 但这样并没有存到全局变量中 项目中的js无法调用到。试着放在new webpack.DefinePlugin中 但拿不到hash值 求大神们支招
刚才看了一下文档和源码,提供一个思路吧
你想获取 output.filename 中设置的 [name].[hash].bundle.js。
[name].[hash].bundle.js
The following substitutions are available in template strings (viawebpack's internal TemplatedPathPlugin):
可以试试 TemplatedPathPlugin 或者扩展 TemplatedPathPlugin。
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
刚才看了一下文档和源码,提供一个思路吧
你想获取 output.filename 中设置的
[name].[hash].bundle.js。可以试试 TemplatedPathPlugin 或者扩展 TemplatedPathPlugin。