repack
repack copied to clipboard
add assetPath to remote assets config
Closes #625
Summary
This pull request adds a new field to the remote assets configuration, allowing the specification of both the path and filename for an asset. Will be reflected in generated URL in AssetSourceResolver
Test plan
- (optional) Ensure that minification in webpack.config is disabled to make the generated JS code easier to inspect.
- Add the following option to the remote-assets section of your webpack.config.js file:
assetPath: ({
resourcePath,
resourceFilename,
resourceDirname,
resourceExtensionType
}) => {
const randomHex = Math.random().toString(16).slice(2, 8)
return `${resourceDirname}/one-more-folder/${resourceFilename}-${randomHex}.${resourceExtensionType}`
},
- Build bundle
- Verify that the remote assets are located in the specified folder and that the filenames include a random hash.
- Check that the generated JavaScript chunk contains a valid URL passed to AssetSourceResolver.