From d07da6d675f3a7c6d156f04b08d755949a75e865 Mon Sep 17 00:00:00 2001 From: Yotam Mann Date: Thu, 25 Jul 2019 14:49:46 -0400 Subject: [PATCH] building es2015 modules this should enable tree-shaking in supporting compilers (like webpack and broserify) --- package.json | 12 ++++++------ tsconfig.json | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 9b68733c..78b14711 100644 --- a/package.json +++ b/package.json @@ -3,16 +3,16 @@ "version": "14.1.0", "description": "A Web Audio framework for making interactive music in the browser.", "main": "build/Tone.js", + "module": "build/esm/index.js", + "types": "build/esm/index.d.ts", "files": [ "README.md", "LICENSE.md", - "build/Tone.js.map", - "build/Tone.js", - "tone.d.ts", + "build", "Tone" ], "scripts": { - "build": "npm run increment-ts && npm run ts:build && npm run webpack:build", + "build": "npm run increment-ts && rm -rf build && npm run ts:build && npm run webpack:build", "codecov": "codecov", "collect": "npm run collect:deps", "collect:deps": "node scripts/collect_deps.js", @@ -31,10 +31,10 @@ "test:node": "node ./test/html/node_test.js", "tsd": "node ./scripts/generate_docs.js", "lint": "tslint --project tsconfig.json", - "ts:build": "rm -rf dist && tsc --project tsconfig.build.json", + "ts:build": "tsc --project tsconfig.build.json", "watch:old": "webpack -w --env.production --mode=development", "watch": "tsc --watch", - "webpack:build": "rm -rf build && webpack -p --env.production" + "webpack:build": "webpack -p --env.production" }, "repository": { "type": "git", diff --git a/tsconfig.json b/tsconfig.json index c28e4e67..9cac3fff 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,12 +3,12 @@ "compilerOptions": { "strictNullChecks": true, "target": "es5", - "module": "commonjs", + "module": "es2015", "noImplicitAny": false, "noUnusedLocals": false, "removeComments": false, "experimentalDecorators": true, - "outDir": "./dist", + "outDir": "./build/esm", "sourceMap": true, "moduleResolution": "node", "strictPropertyInitialization" : true,