-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mangled locale placeholder makes it through to HtmlWebpackPlugin #17
Comments
I'm looking at various ways to integrate localization into my project. I just installed this and I seem to be running into the same problem. webpack.config.jsconst config = {
output: {
filename: '[name].[locale].js'
},
plugins: [
new LocalizeAssetsPlugin({ warnOnUnusedString: true, locales }),
new HtmlWebpackPlugin(),
],
} dist/index.html<script defer="defer" src="main.%5Blocale%3Ab64b2e3f%5D.js"></script> Dist files
Environment
Here is the commit where I attempted to set it up lewismoten/schmuck-miser@61314fe |
Thanks for the reproduction @lewismoten. What's your expected behavior? I'm thinking instead of I haven't used HtmlWebpackPlugin but happy to review any PR to add support. |
Sorry about the delay in getting back. As my project is still in the early stages of layout out architecture, I checked out a few other libraries and settled on something that I didn't need a plugin for localization with webpack. You are correct in your assumptions of expected behavior. |
I'm not sure why this broke in the recent version upgrades. I was able to tag [locale] successfully before some version updates to webpack/htmlplugin. I attempted to look inside https://github.com/privatenumber/webpack-localize-assets-plugin/blob/develop/src/multi-locale.ts for the a logical place to get around this, but i dont seem to be able to if all webpack spits out is locale:b64b2e3f with url encoded text. I expect that if webpack would correctly leave [locale] alone, then this plugin could pick it up and all would be well. Is this a reasonable assumption? Also, if the tag for locale is fixed to [locale:b64b2e3f], could this plugin register that tag as it does [locale] and it would be a simple string check on this side then. This i expect is less likely... but worth asking. I will ask on the html webpack plugin issues and see if this can be fixed by allowing locale to pass unmodified, or something. |
I have managed to work around this for now by doing a manual replace on the string "%5Blocale%3Ab64b2e3f%5D" with my desired locale. The documents still build inside the correct folders en/es/ko etc. The old behavior was better I think. |
If anyone is willing to make a minimal reproduction repository (only webpack config), I'm happy to take a look. |
I'm not in the know about how to actually get locale hooked into an app or interacting with html-webpack-plugin, this plugin only seems to generate the bundles. Something must intentionally load them. I found where that string comes from in this plugin tho:
We hooked Hot module reload also broken: |
can you tell me how did you replace theese sybmols %5Blocale%3Ab64b2e3f%5D to correct locale? |
A bit of an update Working with the author to eventually get this in here. #66 You can install it here: |
Bug description
I am trying to use webpack-localize-assets-plugin alongside html-webpack-plugin. My path starts with
[locale]
but in the compilation process this gets replaced with[locale:b64b2e3f]
. Not the end of the world, but makes the work of replacing this with the appropriate locale name in the HTML generation a bit more complex.It would be great if the original path name could be preserved.
Reproduction steps
Straightforward usage of both plugins (let me know if more is required).
Environment
The text was updated successfully, but these errors were encountered: