Skip to content

Conversation

@Roriz
Copy link

@Roriz Roriz commented Apr 18, 2020

Motivation

In my current project we use rollbar-sourcemap-webpack-plugin, this plugin generate and upload .js.map files on build process. All .js.map files is recommended to no be public:
image

I believe this is a common pattern and other projects should have the same problem

Workaround

For now before of npm run deploy we running rm -R dist/js/*.map but I believe this should be the responsibility of the deploy tool.

Solution

Add another optional config (ignoreMatch) to permit ignore some files based on Globbing patterns.
I think this config should be as default something like !**/*.map, but to not generate break change, suggest the default as an empty string for now.

@nicekiwi
Copy link
Collaborator

Globby matches are supported in 4.0 but gave not been released yet. Although the regex match there currently should let you exclude some files.

@nicekiwi nicekiwi self-requested a review July 13, 2020 22:40
Comment on lines 36 to +37
assetMatch: Joi.string().default('**'),
ignoreMatch: Joi.string().default(''),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could also be done by allowing assetMatch to be an array (I just did it like that locally before I had seen this PR).

Suggested change
assetMatch: Joi.string().default('**'),
ignoreMatch: Joi.string().default(''),
assetMatch: [Joi.string().default('**'), Joi.array().items(Joi.string())],

@nicekiwi looks like even at the current package.json globby version of 8.0.1, the globby.sync method can accept an array of patterns. I tested the change I've suggested locally, and it works with the following to upload all but my map files. Any estimate on when something like this could be merged and released?

pluginOptions: {
  s3Deploy: { 
    assetMatch: ['**', '!(**/*.map)'],
  }
}

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.

3 participants