Skip to content

use JSON.stringify in caching parse results #35

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

Closed
wants to merge 1 commit into from

Conversation

Tidyzq
Copy link

@Tidyzq Tidyzq commented Oct 25, 2018

In order to fix issue: vuejs/rollup-plugin-vue#239
The reason is that rollup will manipulate the styles.map.mapping object, which is in https://github.com/rollup/rollup/blob/ea82d134400ecee72e274a02b0e623959e1b36a8/src/utils/transform.ts#L30

if (originalSourcemap && typeof originalSourcemap.mappings === 'string')
	originalSourcemap.mappings = decode(originalSourcemap.mappings);

So we should return a fresh copy by JSON.stringify and JSON.parse when the cache is hit.

@znck
Copy link
Member

znck commented Oct 28, 2018

The output SFC descriptor should be treated immutable. Rollup plugin should create a copy of descriptor rather than manipulating it directly.

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.

2 participants