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

fix(options): use filename mutated after instantiation #430

Conversation

lbennett-stacki
Copy link
Contributor

This PR contains a:

  • bugfix
  • new feature
  • code refactor
  • test update
  • typo fix
  • metadata update

Motivation / Use-Case

A minor update from 0.6.0 to 0.7.0 broke my webpacker configuration. :(

In 13e9cbf (#381) the moduleFilename function was added. This change broke webpacker configurations that set a non-default filename option.

To explain further, if you view the webpacker plugins docs, options can be mutated after construction.

Excerpt from docs:

// Get a pre-configured plugin
const manifestPlugin = environment.plugins.get('Manifest')
manifestPlugin.options.writeToFileEmit = false

So, previously, I could set a filename like so:

environment.plugins.get('MiniCssExtractPlugin').options.filename = 'static-[contenthash].css'

but after 13e9cbf this was broken and instead you must set moduleFilename: () => yourFilename to fix it.

Breaking Changes

None

Additional Info

@jsf-clabot
Copy link

jsf-clabot commented Jul 18, 2019

CLA assistant check
All committers have signed the CLA.

Copy link

@mistic mistic left a comment

Choose a reason for hiding this comment

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

That LGTM

/CC @evilebottnawi

Copy link

@NoClipDigital NoClipDigital left a comment

Choose a reason for hiding this comment

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

👌

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

Anyway, i am recommend don't do this, due webpack@5 will have built-in cache and using this approach is not good idea

@alexander-akait alexander-akait merged commit 0bacfac into webpack-contrib:master Jul 19, 2019
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.

5 participants