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

"[name].js?[hash]" file name not handled correctly in v2 #19

Closed
Daniel15 opened this issue Aug 22, 2015 · 4 comments
Closed

"[name].js?[hash]" file name not handled correctly in v2 #19

Daniel15 opened this issue Aug 22, 2015 · 4 comments

Comments

@Daniel15
Copy link
Contributor

My Webpack config has something like this in it:

  entry: {
    desktop: './js/desktop.js',
    mobile: './js/mobile.js'
  },
  output: {
    path: path.join(__dirname, 'public', 'assets', 'cache'),
    filename: process.env.NODE_ENV === 'production'
      ? '[name].min.js?[hash]'
      : '[name].js?[hash]',
  },

Output from 0.3.1:

{"desktop":"desktop.js?177b0e49e38f148eb91a","mobile":"mobile.js?177b0e49e38f148eb91a"}

This is easy, I just read the desktop property

Output from 2.2.0:

{"desktop":{"js?177b0e49e38f148eb91a":"desktop.js?177b0e49e38f148eb91a","jsMap":"desktop.js.map?177b0e49e38f148eb91a"},"mobile":{"js?177b0e49e38f148eb91a":"mobile.js?177b0e49e38f148eb91a","jsMap":"mobile.js.map?177b0e49e38f148eb91a"}}

What do I do here? The key has the hash in it :/ I could do the equivalent of Object.keys(assets.desktop)[0] but that's a bit ugly.

I've reverted to 0.3.1 in the meantime.

@Daniel15 Daniel15 changed the title Hash contained within key "[name].js?[hash]" file name not handled correctly in v2 Aug 22, 2015
@sporto
Copy link
Collaborator

sporto commented Aug 22, 2015

@Daniel15 oh, that looks really wrong, the hash is not meant to be in the key. Will look into this.

@Daniel15
Copy link
Contributor Author

It looks like the getFileExt function is only removing querystrings from sourcemaps, perhaps it should be removing them from all files: https://github.com/sporto/assets-webpack-plugin/blob/master/index.js#L123-L125

@sporto
Copy link
Collaborator

sporto commented Aug 22, 2015

@Daniel15 I published a new version 2.2.2, not sure if this fixes your issue, could you test it?

@Daniel15
Copy link
Contributor Author

Daniel15 commented Sep 5, 2015

Yeah this looks good now, thanks! Sorry for the delay in replying.

@Daniel15 Daniel15 closed this as completed Sep 5, 2015
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

No branches or pull requests

2 participants