Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,21 @@
"version": "3.0.2",
"description": "Highly customizable notification snackbars (toasts) that can be stacked on top of each other",
"main": "./index.js",
"module": "./notistack.esm.js",
"module": "./notistack.esm.mjs",
"types": "./index.d.ts",
"exports": {
".": {
"import": {
"types": "./notistack.esm.d.mts",
"default": "./notistack.esm.mjs"
},
"require": {
"types": "./index.d.ts",
"default": "./index.js"
}
},
"./package.json": "./package.json"
},
"license": "MIT",
"author": {
"name": "Hossein Dehnokhalaji",
Expand Down
12 changes: 10 additions & 2 deletions tsdx.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const path = require('node:path');
const copy = require('rollup-plugin-copy');
const bundleSize = require('rollup-plugin-bundle-size');

Expand All @@ -6,11 +7,18 @@ const DIST_FOLDER = 'dist';
module.exports = {
rollup(config) {
config.plugins.push(bundleSize());

let dts = 'index.d.ts';
// Write ESM as .mjs to match Node.js expectations.
if (config.output && config.output.format === 'esm') {
config.output.file = config.output.file.replace(/\.js$/, '.mjs');
dts = path.basename(config.output.file, '.mjs') + '.d.mts';
}
config.plugins.push(
copy({
targets: [
// copy decleration file over
{ src: 'src/types.ts', dest: DIST_FOLDER, rename: 'index.d.ts' },
// copy declaration file over
{ src: 'src/types.ts', dest: DIST_FOLDER, rename: dts },
],
})
);
Expand Down