Skip to content
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

Add transformFilePath option #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mxstbr
Copy link

@mxstbr mxstbr commented Jun 21, 2019

When bundling a React app with create-react-app, it hashes the resulting bundle names, i.e. the filenames change every time.

This PR adds support for a transformFilePath option, which allows for usage with hashed file names. The example taken from the test I added:

    const plugin = new SizePlugin({
      globPattern: '**/*',
      // Remove hashes from filenames with a regex, note that this is not the most solid regex but good enough for the test
      transformFilePath: (path) => path.replace(/(.+?\.)(.+?\.)?(txt|jpg)/i, '$1$3'),
    });

When bundling a React app with create-react-app, it hashes the resulting
bundle names, i.e. the filenames change every time.

This commit adds support for a `transformFilePath` option, which allows
for usage with hashed file names.
@mxstbr
Copy link
Author

mxstbr commented Jun 21, 2019

CI fails due to me being on a fork I think:

Bad response: 422 {"message":"Couldn't find a repository matching this job.","error":true}

The tests pass though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant