webpack-merge-and-include-globally
webpack-merge-and-include-globally copied to clipboard
Supporting [hash] during production build
Hi,
I noticed this doesn't seem to support [hash] during a production build. This would be really useful for us, is there any chance this could be added?
do you mean reprocessing only files that changed? can you introduce me to hashing?
The hash could be used for the manifest.json
file.
added hash
option (true/false
) to append hash before file extension, using rev-hash
library
The file has now the hash before the extension. But there is no entry in the manifest.json file.
This problem relates to #11
@markshapiro I have same problem. There is no entry in manifest.json
file.
It seems adjusting the plugin's priority to higher is able to add files to manifest.json, but both of the file names are hashed:
"build/app-s29a0wlk.js": "build/app-s29a0wlk.js"
i see the hash option ,but how to use it at vue cli3 scaffold
@Insua is there an option to use general webpack plugins in vue cli3? if not I can distill the file transform code from webpack code, so that the merge logic could be reused in different bundlers.
vue cli3 can use generally webpack config,but I do not know how to inject js file to index.html
@zhanghuanchong I found temporary solution here: https://github.com/webpack-contrib/copy-webpack-plugin/issues/104
new ManifestPlugin({
map: (file) => {
if (process.env.NODE_ENV === 'production') {
file.name = file.name.replace(/(\-[a-f0-9]{10})(\..*)$/, '$2');
}
return file;
},
}),
fixed the double names, the plugin appears not to be working with version 1 ofwebpack-manifest-plugin
, v2 works.
@Insua will this help? https://stackoverflow.com/questions/45145448/including-external-script-in-vue-js-template
The hash option generates now a correct entry in my manifest file. But it does ignore the manifest plugin configuration for the hash placement.
Example:
{
"build/script.js": "/build/script-3ce06daa80.js",
}
@thejahweh you mean when you configure yourself the hash ending in the manifest plugin? are you using webpack-manifest-plugin
v2?
Yes I'm using [email protected]
.
But I'm using Symfony Encore for the configuration, so I really don't know what configureFilenames
does under the hood, maybe they'r using another plugin for this?
.configureFilenames({
js: '[name].js?[contenthash:16]',
css: '[name].css?[contenthash:16]',
images: 'images/[name].[ext]?[hash:16]',
fonts: 'fonts/[name].[ext]?[hash:16]'
})
@thejahweh shall I then give option to use custom hash for each file? or maybe the right solution is to automatically recognize the configuration of manifest plugin and use it? do you know maybe the configuration property that is used in the manifest plugin?
As far as I see, this has to do with the Webpack loaders.
For example: https://github.com/webpack-contrib/file-loader You can see that there is a options name configuration, which is used to save the file with a pre defined naming scheme.
Hi, why is the issue still open? For me everything is fine with the hash option:
content of mainfest.json
"components.js": "/dist/components-bb1cea7358.js",