Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Doesn't work properly when webpack has minimization enabled #137

Closed
grumd opened this issue Jan 28, 2021 · 2 comments
Closed

Doesn't work properly when webpack has minimization enabled #137

grumd opened this issue Jan 28, 2021 · 2 comments

Comments

@grumd
Copy link

grumd commented Jan 28, 2021

I have svg-to-pdfkit working completely fine in web when building with webpack, but as soon as I just flip "optimization.minimize: false" to "optimization.minimize: true" in webpack, fill with <pattern> stops working and all I see is solid black fill.

Using latest version for PDFKit and this plugin, and webpack 5.

It's a long shot posting here but I'm just feeling lucky, maybe anyone has an idea what can cause black fill instead of pattern fill... Really hard to debug webpack's minimizer. I tried putting all the pdf-related modules into "excludes" for TerserPlugin but it didn't help.

@grumd
Copy link
Author

grumd commented Jan 29, 2021

I didn't really understand how exactly terser breaks svg-to-pdfkit, but I was able to create a separate chunk for this package, and then disable TerserPlugin only for that chunk
image

@pjrocks70
Copy link

To fix this issue I have used fnames: true in terseroptions.

new TerserPlugin({
					extractComments: false,
					terserOptions: {
						keep_classnames: true,
						keep_fnames: true,
						},
				})

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants