Open xiaohai-huang opened 2 months ago
My current workaround is to either change the file names or specify the assetModuleFilename
in webpack config using webpack-merge.
const { merge } = require("webpack-merge");
module.exports = (env, baseConfig) => {
const config = merge(baseConfig, {
output: {
assetModuleFilename: "static/media/[name].[hash][ext]",
},
});
return config;
};
Description
Images load correctly during development, but when the React app is served from the Resources folder, incorrect images are displayed due to identical file names with different extensions.
Steps to Reproduce
Build the react app. Below shows the files are all stored under /static/media/ folder.
ResourcesHelper.LoadResource
is unable to load the correct image.Potential Cause
Currently, the files in Resources folder are loaded without file extension.
https://github.com/ReactUnity/core/blob/fef8c873b41af0922c3cffe6e98d37dc0efee34f/Runtime/Types/AssetReference.cs#L168-L188
https://github.com/ReactUnity/core/blob/fef8c873b41af0922c3cffe6e98d37dc0efee34f/Runtime/Helpers/ResourcesHelper.cs#L55-L63