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

support for output.devtoolModuleFilenameTemplate #75

Open
bholloway opened this issue Aug 16, 2018 · 1 comment
Open

support for output.devtoolModuleFilenameTemplate #75

bholloway opened this issue Aug 16, 2018 · 1 comment

Comments

@bholloway
Copy link

Migrating a build to Webpack 4 and the new extract css methodology.

I'm up and running so thanks to you for your efforts with this plugin.

I have always made good use of source-maps, even in production, and I was able to get this working too. Currently I am using version ^4.0.0 as followings.

{
  output: {
    ...
    devtoolModuleFilenameTemplate: templateFn,
    devtoolFallbackModuleFilenameTemplate: templateFn
  },
  ...
  optimization: {
    minimizer: [
      new OptimizeCSSAssetsPlugin({
        cssProcessorOptions: {
          map: true,
          ...
        }
      })
    ]
  }
}

Historically I have found devtoolModuleFilenameTemplate is essential for getting useful source-maps.

However it seems that this plugin bypasses devtoolModuleFilenameTemplate for extracted .css.map.

As a work around I am using an additional plugin.

new LastCallWebpackPlugin({
  assetProcessors: [{
    regExp: /\.css\.map/,
    processor: (assetName, asset) => Promise.resolve(JSON.parse(asset.source()))
      .then(obj => ...apply templateFn...)
      .then(obj => JSON.stringify(obj))
  }]
})

So I am not blocked. However is there any chance that the plugin can support devtoolModuleFilenameTemplate in future?

Or equally is this some misconfiguration on my part?

@galvarez421
Copy link

This does not seem to be a misconfiguration your part. Related to #91 and #53 (comment).

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