Skip to content

Commit

Permalink
fix: publish source and include sourcemaps (#1958)
Browse files Browse the repository at this point in the history
  • Loading branch information
kettanaito committed Jan 8, 2024
1 parent a9c5adf commit 68a57bd
Show file tree
Hide file tree
Showing 4 changed files with 348 additions and 187 deletions.
11 changes: 11 additions & 0 deletions config/plugins/esbuild/forceEsmExtensionsPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ export function forceEsmExtensionsPlugin(): Plugin {
}

for (const outputFile of result.outputFiles || []) {
// Only target CJS/ESM files.
// This ignores additional files emitted, like sourcemaps ("*.js.map").
if (
!(
outputFile.path.endsWith('.js') ||
outputFile.path.endsWith('.mjs')
)
) {
continue
}

const fileContents = outputFile.text
const nextFileContents = modifyRelativeImports(fileContents, isEsm)

Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
"config/scripts/postinstall.js",
"cli",
"lib",
"src",
"browser",
"node",
"native",
Expand All @@ -115,7 +116,7 @@
"@bundled-es-modules/js-levenshtein": "^2.0.1",
"@bundled-es-modules/statuses": "^1.0.1",
"@mswjs/cookies": "^1.1.0",
"@mswjs/interceptors": "^0.25.13",
"@mswjs/interceptors": "^0.25.14",
"@open-draft/until": "^2.1.0",
"@types/cookie": "^0.4.1",
"@types/js-levenshtein": "^1.1.1",
Expand Down Expand Up @@ -158,7 +159,7 @@
"cross-env": "^7.0.3",
"cross-fetch": "^3.1.5",
"cz-conventional-changelog": "3.3.0",
"esbuild": "^0.17.15",
"esbuild": "^0.19.11",
"esbuild-loader": "^2.21.0",
"eslint": "^7.30.0",
"eslint-config-prettier": "^8.3.0",
Expand All @@ -176,7 +177,7 @@
"rimraf": "^3.0.2",
"simple-git-hooks": "^2.8.0",
"ts-node": "^10.9.1",
"tsup": "^6.7.0",
"tsup": "^8.0.1",
"typescript": "^5.0.2",
"undici": "^5.20.0",
"url-loader": "^4.1.1",
Expand Down
Loading

0 comments on commit 68a57bd

Please sign in to comment.