Skip to content

Commit e806b93

Browse files
committed
fix: preserve distribution source-map filenames
1 parent 6d4b666 commit e806b93

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

‎README.md‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -634,15 +634,13 @@ Note that `JSON` cases use `Buffer` to emulate I/O where a JavaScript string mus
634634

635635
### NPM / npmjs.com
636636

637-
The NPM package distributed in npmjs.com includes both ES2015+ and ES5 files:
637+
The npm package provides three ES2020-targeted builds:
638638

639-
* `dist/` is compiled into ES2020 with CommomJS, provided for NodeJS v10
640-
* `dist.umd/` is compiled into ES5 with UMD
641-
* `dist.umd/msgpack.min.js` - the minified file
642-
* `dist.umd/msgpack.js` - the non-minified file
643-
* `dist.esm/` is compiled into ES2020 with ES modules, provided for webpack-like bundlers and NodeJS's ESM-mode
639+
* `dist.cjs/index.cjs`: CommonJS entry point for Node.js `require()`, with `index.d.cts` declarations.
640+
* `dist.esm/index.mjs`: ES module entry point for Node.js `import` and compatible bundlers, with `index.d.mts` declarations.
641+
* `dist.umd/msgpack.min.js` and `dist.umd/msgpack.js`: minified and unminified browser bundles, respectively.
644642

645-
If you use NodeJS and/or webpack, their module resolvers use the suitable one automatically.
643+
Node.js requires version 18 or later. Use the package name `@msgpack/msgpack` rather than a path into `dist.cjs/` or `dist.esm/`; the package export map selects the appropriate entry point.
646644

647645
### CDN / unpkg.com
648646

‎tools/fix-ext.mts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ for (const file of files) {
3535

3636
// .js.map => .mjs.map
3737
const mapping = JSON.parse(fs.readFileSync(`${file}.map`).toString("utf-8"));
38-
mapping.file = mapping.file.replace(/\.js$/, ext);
38+
mapping.file = mapping.file.replace(/\.js$/, `.${ext}`);
3939
fs.writeFileSync(`${fileMjs}.map`, JSON.stringify(mapping));
4040
fs.unlinkSync(`${file}.map`);
4141
}

0 commit comments

Comments
 (0)