Skip to content

Commit 059cfba

Browse files
committed
Use .mjs for module code
* Writes .mjs instead of .js for code within ./module * Add a top level index.mjs file (which simply redirects to ./module) Fixes #1217
1 parent 7e68984 commit 059cfba

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"version": "0.13.0",
44
"description": "A Query Language and Runtime which can target any service.",
55
"license": "MIT",
6-
"main": "index.js",
7-
"module": "module/index.js",
6+
"main": "index",
7+
"module": "index.mjs",
88
"homepage": "https://github.com/graphql/graphql-js",
99
"bugs": {
1010
"url": "https://github.com/graphql/graphql-js/issues"
@@ -34,8 +34,8 @@
3434
"build:package-json": "node ./resources/copy-package-json.js",
3535
"build:npm": "babel src --optional runtime --ignore __tests__ --out-dir dist/",
3636
"build:npm-flow": "find ./src -name '*.js' -not -path '*/__tests__*' | while read filepath; do cp $filepath `echo $filepath | sed 's/\\/src\\//\\/dist\\//g'`.flow; done",
37-
"build:module": "BABEL_MODULES=1 babel src --optional runtime --ignore __tests__ --out-dir dist/module/",
38-
"build:module-flow": "find ./src -name '*.js' -not -path '*/__tests__*' | while read filepath; do cp $filepath `echo $filepath | sed 's/\\/src\\//\\/dist\\/module\\//g'`.flow; done",
37+
"build:module": "BABEL_MODULES=1 babel src --optional runtime --ignore __tests__ --out-dir dist/module/ && for file in $(find dist/module -name '*.js'); do mv \"$file\" \"${file%.js}.mjs\"; done && echo \"export * from './module'; /*:: export type * from './module'; */\" > dist/index.mjs",
38+
"build:module-flow": "find ./src -name '*.js' -not -path '*/__tests__*' | while read filepath; do cp $filepath `echo $filepath | sed 's/\\/src\\//\\/dist\\/module\\//g; s/.js$/.mjs.flow/g'`; done",
3939
"preversion": ". ./resources/checkgit.sh && npm test",
4040
"prepublish": ". ./resources/prepublish.sh",
4141
"gitpublish": ". ./resources/gitpublish.sh"

0 commit comments

Comments
 (0)