javascript - How does webpack hang the hash value of this build globally for use by js code?
为情所困
为情所困 2017-05-19 10:41:55
0
1
537

When I use webpack to build, I want to save the hash value in a global variable so that the js of other modules can be called. I tried configuring it. Only putting it in the file name, such as output: 'a[hash].js', will have the effect. But this is not saved in the global variable and the js in the project cannot be called. I tried putting it in new webpack.DefinePlugin but I couldn’t get the hash value. Please give me some advice.

为情所困
为情所困

reply all(1)
为情所困

I just looked at the documentation and source code, can you provide me with an idea

You want to get the [name].[hash].bundle.js set in output.filename.

The following substitutions are available in template strings (via
webpack's internal TemplatedPathPlugin):

You can try TemplatedPathPlugin or extend TemplatedPathPlugin.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template