Skip to content

Unnecessary Buffer polyfill when source maps are disabled #454

Closed
@ArgonAlex

Description

@ArgonAlex

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
After upgrading from css-loader 0.26.4 to 0.27.3 webpack is including a polyfill for Buffer in the bundle when source maps are not enabled. This is resulting in an increased bundle size, even though the polyfill is never actually used.

If the current behavior is a bug, please provide the steps to reproduce.
Install css-loader 0.23.7, run a webpack build, and check the resulting bundle.

What is the expected behavior?
If source maps are not enabled, then there is no need to output the toComment function in lib/css-base.js, which uses Buffer. The loader should only output this function if source maps are enabled.

Please mention other relevant information such as your webpack version, Node.js version and Operating System.
Windows 8.1
Node 6.9.5
Webpack 2.2.1

My current workaround is just adding

node: {
  Buffer: false
}

to the webpack config, but I think it would be better if the loader could handle this.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions