Skip to content

Conversation

WilsonLiu95
Copy link

feature(sourcemap&cssMinify):

  1. sourcemap support
  • ignore sourcemap inline comment while generate hash
  • replace content file inline sourcemap comment hash to new hash
  • change sourcemap file to have new hash
  1. support optimize-cssnano-plugin(minify css plugin).We should generate hash after this plugin
  • support optimize-cssnano-plugin in function replaceStringInAsset
  • when set optimize-cssnano-plugin disable sourcemap, css map in assets will be deleted

@WilsonLiu95 WilsonLiu95 force-pushed the master branch 2 times, most recently from df4768b to 1c2994f Compare February 18, 2019 07:37
…nerate hash & support optimize-cssnano-plugin
@wmertens
Copy link

The nice thing about this is that if the js is unchanged, it will get the same hash after every webpack run, which means that browsers will only fetch really unchanged js files.
It would be great to see this merged @scinos 😬

// Reuses webpack options
hashFn = input => {
// generate hash of content without sourcemap
const mapCommentReg = /\s\/[\/|*]#\s?sourceMappingURL=.*.map(\s\*\/)?/g;

Choose a reason for hiding this comment

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

Shouldn't this regex match only on the beginning of the line? Also, can there be more than one mapComment?

@juliomrc
Copy link

Any updates @scinos ? Compatibility with source-maps would be a huge plus! :D

@wmertens
Copy link

wmertens commented Oct 6, 2019

I found another source of "self"-references: license files.

How about ignoring the name of the file when calculating the file hash? So if the file is called foo_123484.js, the hash calculation should find all mentions of foo_123484(.extregex), check if they are files, and replace them with equal length \0 strings. Afterwards, rename the file and any other references and files found.

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