Keep [hash] included within CopyWebpackPlugin
See original GitHub issueCurrently I’m using copy-webpack-plugin
with the following configuration
{
from: resolve('src/app/app.settings.js'),
to: resolve(OUTPUT_PATH, 'config/[name].[hash].[ext]'),
flatten: true,
}
The output would include the [hash]
and it would look something like app.settings.3eaa9798d11464fbfd3a9c5d412d6b67.js
, but as stayed in the README
Note that since copy-webpack-plugin does not actually copy the files to webpack's output directory until after html-webpack-plugin has completed, it is necessary to use the globPath to retrieve filename matches relative to the original location of any such files.
So I was wondering if there’s a way for me to glob
the name like app.settings.*.js
so the file can be included in the html including the [hash]
, if I make the globPath
point at the original file, it only keeps the original name.
I appreciate any direction, even if its using a different plugin.
Regards.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
CopyWebpackPlugin | webpack
copy-webpack-plugin is not designed to copy files generated from the build process; rather, it is to copy files that already exist in the...
Read more >copy-webpack-plugin-hash - npm package - Snyk
Copy files && directories with webpack For more information about how to use this package see README · Ensure you're using the healthiest...
Read more >copy-webpack-plugin-hash - npm
Copy files && directories with webpack. Latest version: 6.0.0, last published: 5 years ago. Start using copy-webpack-plugin-hash in your ...
Read more >Webpack 4: how to copy a json file while adding a hash to the ...
Trying to use !!file-loader yields the same result. Another option could be to use copy-webpack-plugin with [hash] but then how to link to ......
Read more >How to Copy Files Using the Copy Webpack Plugin (without ...
In a project using Webpack for the bundler, I needed to copy a folder from a node_modules directory and include the files in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
ok, I’m glad that you seem to have found a solution to your problem. I’m closing the issue…
Ok, I’ve added support for the
hash
option to be a function to allow for your use case, and published to npm as version1.0.7
.The README was updated to give an example:
and a unit test was added to show that it works:
https://github.com/jharris4/html-webpack-include-assets-plugin/blob/master/spec/index.spec.js#L1352
Please let me know whether this works for you so I can close this issue! 😉