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

chore(plugin-vue): replace source-map with gen/trace-mapping #8155

Merged
merged 1 commit into from
May 13, 2022

Conversation

sapphi-red
Copy link
Member

@sapphi-red sapphi-red commented May 13, 2022

Description

This PR replaces source-map with @jridgewell/gen-mapping and @jridgewell/trace-mapping.
This reduces package size.

before after diff (%)
package size 79.8kB 44.7kB -35.1kB -43.98%
unpacked size 311.0kB 155.9kB -155.1kB -49.87%

Simillar to #6746.

Additional context

Another approach is to turn source-map into dep. source-map is a dep of @vue/compiler-core/@vue/compiler-sfc.
Or source-map-js which is a dep of postcss (@vue/compiler-sfc).


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@sapphi-red sapphi-red added dependencies Pull requests that update a dependency file p1-chore Doesn't change code behavior (priority) labels May 13, 2022
@@ -3,7 +3,10 @@ import type { SFCBlock, SFCDescriptor } from 'vue/compiler-sfc'
import type { PluginContext, SourceMap, TransformPluginContext } from 'rollup'
import { normalizePath } from '@rollup/pluginutils'
import type { RawSourceMap } from 'source-map'
Copy link
Member Author

Choose a reason for hiding this comment

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

source-map is still needed for type. (not included in bundle though)

Copy link
Member

@patak-dev patak-dev left a comment

Choose a reason for hiding this comment

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

Awesome! I think we can start with this change. Maybe instead of making source-map a dep, vue may end up also migrating to gen-mapping, trace-mapping?

@patak-dev patak-dev merged commit 79a8c85 into vitejs:main May 13, 2022
@sapphi-red sapphi-red deleted the chore/vue-trace-mapping branch May 13, 2022 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file p1-chore Doesn't change code behavior (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants