From 11ed977ab1c06be8d66aad58b9a13ca741552085 Mon Sep 17 00:00:00 2001 From: Andrew Calcutt Date: Wed, 4 May 2022 11:46:42 -0700 Subject: [PATCH] fix for "is an ES module file" in node 12+ when using style-spec npm package (#1223) --- .gitignore | 2 +- rollup.config.style-spec.ts | 2 +- src/style-spec/CHANGELOG.md | 6 ++++++ src/style-spec/package.json | 4 ++-- test/build/style-spec.test.ts | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 7aa829d7c2..c712e3d5e9 100644 --- a/.gitignore +++ b/.gitignore @@ -22,7 +22,7 @@ test/integration/dist/**/*.json test/integration/query/dist/fixtures.json */**/*.g.ts .eslintcache -src/style-spec/dist/index.js +src/style-spec/dist/index.cjs _batfish_site _batfish_tmp _site diff --git a/rollup.config.style-spec.ts b/rollup.config.style-spec.ts index 6f496782e3..1d8e9d5d84 100644 --- a/rollup.config.style-spec.ts +++ b/rollup.config.style-spec.ts @@ -14,7 +14,7 @@ const config: RollupOptions[] = [{ input: 'src/style-spec/style-spec.ts', output: { name: 'maplibreGlStyleSpecification', - file: `dist/style-spec/${esm ? 'index.mjs' : 'index.js'}`, + file: `dist/style-spec/${esm ? 'index.mjs' : 'index.cjs'}`, format: esm ? 'esm' : 'umd', sourcemap: true }, diff --git a/src/style-spec/CHANGELOG.md b/src/style-spec/CHANGELOG.md index 5d2cbf722b..e030228991 100644 --- a/src/style-spec/CHANGELOG.md +++ b/src/style-spec/CHANGELOG.md @@ -1,3 +1,9 @@ +## 16.0.0 + +### Breaking changes + +* index.js has been renamed to index.cjs to fix the 'is treated as an ES module file' error in node 12+ [#1223](https://github.com/maplibre/maplibre-gl-js/pull/1223) + ## 15.1.0 ### ✨ Features and improvements diff --git a/src/style-spec/package.json b/src/style-spec/package.json index 3826c918ea..c5a1481349 100644 --- a/src/style-spec/package.json +++ b/src/style-spec/package.json @@ -1,7 +1,7 @@ { "name": "@maplibre/maplibre-gl-style-spec", "description": "a specification for maplibre gl styles", - "version": "15.1.0", + "version": "16.0.0", "author": "MapLibre", "keywords": [ "mapbox", @@ -12,7 +12,7 @@ "maplibre-gl-js" ], "license": "ISC", - "main": "./dist/index.js", + "main": "./dist/index.cjs", "module": "./dist/index.mjs", "type": "module", "scripts": { diff --git a/test/build/style-spec.test.ts b/test/build/style-spec.test.ts index 0f5d748762..274ad4549e 100644 --- a/test/build/style-spec.test.ts +++ b/test/build/style-spec.test.ts @@ -2,7 +2,7 @@ import isBuiltin from 'is-builtin-module'; import * as rollup from 'rollup'; import rollupConfig from '../../rollup.config.style-spec'; import styleSpecPackage from '../../src/style-spec/package.json'; -import * as spec from '../../dist/style-spec/index.js'; +import * as spec from '../../dist/style-spec/index.cjs'; /* eslint-disable import/namespace */ import {RollupOptions} from 'rollup';