From 24d685564c4c546b00a55baf08fd4b11b1b82602 Mon Sep 17 00:00:00 2001 From: Kenta Moriuchi Date: Sat, 9 Oct 2021 18:53:58 +0900 Subject: [PATCH] Update to use .cjs extension --- .babelrc | 2 +- package.json | 6 +++--- test/lib/setup.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.babelrc b/.babelrc index 8e16f5d9..8a6e1d64 100644 --- a/.babelrc +++ b/.babelrc @@ -2,7 +2,7 @@ "plugins": [ "@babel/plugin-transform-modules-commonjs", ["replace-import-extension", { - "extMapping": { ".mjs": ".js" } + "extMapping": { ".mjs": ".cjs" } }] ], "assumptions": { diff --git a/package.json b/package.json index 9f4aa98d..3fcfd52e 100644 --- a/package.json +++ b/package.json @@ -2,10 +2,10 @@ "name": "@petamoriken/float16", "description": "half precision floating point for JavaScript", "version": "3.4.8", - "main": "./lib/index.js", + "main": "./lib/index.cjs", "module": "./src/index.mjs", "exports": { - "require": "./lib/index.js", + "require": "./lib/index.cjs", "import": "./src/index.mjs" }, "types": "index.d.ts", @@ -43,7 +43,7 @@ ], "scripts": { "build": "yarn run build:lib; yarn run build:browser", - "build:lib": "babel src -d lib", + "build:lib": "babel src -d lib --out-file-extension .cjs", "build:browser": "rollup -c", "docs": "mkdir -p docs && cp README.md docs/index.md; yarn run docs:test", "docs:test": "mkdir -p docs/test && cp browser/float16.js docs/test/float16.js; yarn run docs:test:assets; yarn run docs:test:dependencies", diff --git a/test/lib/setup.js b/test/lib/setup.js index f628f31d..ef699a65 100644 --- a/test/lib/setup.js +++ b/test/lib/setup.js @@ -8,7 +8,7 @@ require("espower-loader")({ }); const assert = require("power-assert"); -const float16 = require("../../lib/index.js"); +const float16 = require("../../lib/index.cjs"); Object.assign(global, float16); global.assert = assert;