Skip to content

Commit

Permalink
patch @parcel/transformer-vue to use relative paths for id hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
powerpaul17 committed Sep 29, 2023
1 parent eca287d commit 6275ffb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## [Unreleased]

- patch @parcel/transformer-vue to use relative paths for scope ids

## [0.4.1] - 2023-09-29

- do not include source maps in production builds
Expand Down
21 changes: 21 additions & 0 deletions patches/@parcel+transformer-vue+2.9.3.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff --git a/node_modules/@parcel/transformer-vue/lib/VueTransformer.js b/node_modules/@parcel/transformer-vue/lib/VueTransformer.js
index 6e77a66..a6de57a 100644
--- a/node_modules/@parcel/transformer-vue/lib/VueTransformer.js
+++ b/node_modules/@parcel/transformer-vue/lib/VueTransformer.js
@@ -125,10 +125,15 @@ var _default = new (_plugin().Transformer)({
});
}
const descriptor = parsed.descriptor;
+
+ const path = require('path');
+ const relativeFilePath = path.relative(process.cwd(), asset.filePath)
+
let id = (0, _utils().hashObject)({
- filePath: asset.filePath,
+ filePath: relativeFilePath,
source: options.mode === 'production' ? code : null
}).slice(-6);
+
return {
type: 'vue',
version: '3.0.0',

0 comments on commit 6275ffb

Please sign in to comment.