I want to use pack filename like this:
<%= javascript_pack_tag 'application.react' %> (in layout erb file)<%= javascript_pack_tag 'application.vue' %> (in layout erb file)馃憤 Expected behavior:
// manifest.json
{
:
"application.react.js": "/packs/application.react-4543357cf6a6fee4f0541020f60fa1d5.js",
"application.vue.js": "/packs/application.vue-4543357cf6a6fee4f0541020f60fa1d5.js",
:
:
}
馃憥 But, Current behavior is:
// manifest.json
{
:
"application.js": "/packs/application-4543357cf6a6fee4f0541020f60fa1d5.js",
:
:
}
.react and .vue disappeared from the file name馃槶
How can I prevent this behavior?
As far as I can see, the name is collected here:
and then output here:
To change this, you'd need to overwrite in your app by merging on top of the default config. The best place would likely be inside of your config/webpack/environment.js file
Here is a helper webpack guide:
https://webpack.js.org/configuration/output/
That being said, it is probably a much better idea for you to go with something like a dash or underscore (application-react or application_react) instead of a period (application.react) because as soon as you overwrite the default, you own your problem.
Most helpful comment
As far as I can see, the name is collected here:
https://github.com/rails/webpacker/blob/af471dcb4ae32cfebd43dc5ad4d037b7fe6d00fc/package/environment.js#L46
and then output here:
https://github.com/rails/webpacker/blob/af471dcb4ae32cfebd43dc5ad4d037b7fe6d00fc/package/environment.js#L65-L66
To change this, you'd need to overwrite in your app by merging on top of the default config. The best place would likely be inside of your
config/webpack/environment.jsfileHere is a helper webpack guide:
https://webpack.js.org/configuration/output/
That being said, it is probably a much better idea for you to go with something like a dash or underscore (
application-reactorapplication_react) instead of a period (application.react) because as soon as you overwrite the default, you own your problem.