Skip to content

Commit

Permalink
fix for "is an ES module file" in node 12+ when using style-spec npm …
Browse files Browse the repository at this point in the history
…package (#1223)
  • Loading branch information
acalcutt authored May 4, 2022
1 parent fb56392 commit 11ed977
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.style-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down
6 changes: 6 additions & 0 deletions src/style-spec/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/style-spec/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -12,7 +12,7 @@
"maplibre-gl-js"
],
"license": "ISC",
"main": "./dist/index.js",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"type": "module",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion test/build/style-spec.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit 11ed977

Please sign in to comment.