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

feat: allow the option filename to be a function #143

Closed
berthertogen opened this issue May 14, 2018 · 4 comments
Closed

feat: allow the option filename to be a function #143

berthertogen opened this issue May 14, 2018 · 4 comments

Comments

@berthertogen
Copy link

Can we allow the filename and chunkFilename passed in trought the constructor to be functions instead of string only?

In our case it would make it easy to toggle the [hashcontent] for some bundles.
We would pass the option as followed:
filename: (chunk) => chunk.name === "NotHashedBundle" ? '[name].css' : '[name].[contenthash].css'

Might be worth noting that the latest version of webpack also supports something simular to this in their output.
eg: filename: (data) => data.chunk.name === "NotHashedBundle" ? '[name].js' : '[name].[chunkhash].js'

@alexander-akait
Copy link
Member

PR welcome 👍

@berthertogen
Copy link
Author

berthertogen commented May 14, 2018

Ok, I'm on it.

Quick question, at the moment I can't get the tests passing, I'm getting Error: expect(received).toEqual(expected) but the expected and received printed out after this message seem to be the same.
My encoding is the same (utf-8), from what I can see its failing on carriage return. Any hint on how to get this fixed?

@berthertogen berthertogen changed the title Feature: allow the option filename to be a function. feat: allow the option filename to be a function May 14, 2018
@glen-84
Copy link

glen-84 commented Jun 16, 2018

Duplicate of #67?

@alexander-akait
Copy link
Member

@glen-84 yep, duplicate.

Close in favor #67

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

Successfully merging a pull request may close this issue.

3 participants