From bb7f443cc51bf56c24bf3274a5021cd4c3c14d60 Mon Sep 17 00:00:00 2001 From: George Date: Tue, 11 Jul 2023 10:38:46 -0700 Subject: [PATCH] Broaden library compatibility by transpiling Stellar dependencies (#837) * Add babel transpiling to es6 dependencies * Don't use tsc to compile, just check --- .babelrc => babel.config.json | 12 ++++-------- config/tsconfig.json | 5 ++++- config/webpack.config.browser.js | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) rename .babelrc => babel.config.json (61%) diff --git a/.babelrc b/babel.config.json similarity index 61% rename from .babelrc rename to babel.config.json index c401493c0..be37815c0 100644 --- a/.babelrc +++ b/babel.config.json @@ -1,24 +1,20 @@ { - "comments": false, + "comments": true, // for debugging & jsdocs "presets": [ "@babel/preset-env", "@babel/typescript" ], "targets": { - "node": 14, - "browsers": [ "> 2%" ] + "browsers": [ "> 2%" ] // target modern browsers and ES6 }, "env": { "development": { - "comments": true, // for debugging "plugins": [ "istanbul" ] // for code coverage }, - "docs": { - "comments": true // for jsdocs - }, "production": { - // stricter target for final browser bundle + "comments": false, "targets": { + "node": 14, "browsers": [ "> 2%", "ie 11", diff --git a/config/tsconfig.json b/config/tsconfig.json index 43ff48d73..76fdf22b3 100644 --- a/config/tsconfig.json +++ b/config/tsconfig.json @@ -2,11 +2,14 @@ "extends": "@stellar/tsconfig", "compilerOptions": { "declaration": true, + "emitDeclarationOnly": true, "declarationDir": "../lib", + "removeComments": false, + "lib": ["ES6"], "moduleResolution": "node", "rootDir": "../src", "outDir": "../lib", "target": "es6" }, "include": ["../src"] -} +} \ No newline at end of file diff --git a/config/webpack.config.browser.js b/config/webpack.config.browser.js index 6cd2d3a46..b7c704dd0 100644 --- a/config/webpack.config.browser.js +++ b/config/webpack.config.browser.js @@ -32,7 +32,7 @@ const config = { rules: [ { test: /\.m?(ts|js)$/, - exclude: /node_modules/, + exclude: /node_modules\/(?!(stellar-base|js-xdr))/, use: { loader: 'babel-loader', options: {