From 065701986514fedd722ca06a963253bca627b390 Mon Sep 17 00:00:00 2001 From: Julien Deniau Date: Fri, 30 May 2025 15:21:37 +0000 Subject: [PATCH] Continue to build commonjs until immutable v6 --- packages/devtools/demo/demo.js | 2 +- packages/devtools/package.json | 7 +++++-- packages/devtools/rollup.config.js | 14 ++++++++++---- packages/devtools/test.js | 2 +- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/packages/devtools/demo/demo.js b/packages/devtools/demo/demo.js index 98e9ef7..7facf9e 100644 --- a/packages/devtools/demo/demo.js +++ b/packages/devtools/demo/demo.js @@ -1,5 +1,5 @@ import * as Immutable from 'immutable'; -import installDevTools from '../dist/index.js'; +import installDevTools from '../dist/index.mjs'; var MyRecord = Immutable.Record( { diff --git a/packages/devtools/package.json b/packages/devtools/package.json index 6048416..65acca9 100644 --- a/packages/devtools/package.json +++ b/packages/devtools/package.json @@ -5,16 +5,19 @@ "description": "Chrome Dev Tools formatter for the Immutable JS library", "exports": { ".": { - "import": "./dist/index.js", + "import": "./dist/index.mjs", + "require": "./dist/index.cjs", "types": "./dist/index.d.ts" } }, + "main": "dist/index.cjs", + "types": "dist/index.d.ts", "files": [ "dist" ], "scripts": { "build:types": "tsc", - "build:module": "rollup -c", + "build:module": "rm -rf dist; rollup -c", "build": "yarn run build:types && yarn run build:module", "lint:types": "tsc --noEmit", "lint": "yarn run lint:types", diff --git a/packages/devtools/rollup.config.js b/packages/devtools/rollup.config.js index 7495013..5a2f3a1 100644 --- a/packages/devtools/rollup.config.js +++ b/packages/devtools/rollup.config.js @@ -29,10 +29,16 @@ function injectDemoSource() { const config = [ { input: 'src/index.ts', - output: { - dir: 'dist', - format: 'es', - }, + output: [ + { + file: 'dist/index.mjs', + format: 'es', + }, + { + file: 'dist/index.cjs', + format: 'cjs', + }, + ], plugins: [ babel({ babelHelpers: 'bundled', diff --git a/packages/devtools/test.js b/packages/devtools/test.js index 687897d..1ee12f6 100644 --- a/packages/devtools/test.js +++ b/packages/devtools/test.js @@ -3,7 +3,7 @@ import Immutable4 from 'immutable'; import Immutable3 from 'immutable3'; -import installDevTools from './dist/index.js'; +import installDevTools from './dist/index.mjs'; installDevTools(Immutable4); console.log('Testing with Immutable 4');