From 6ad7cfe4cc6c144169280bfe5f2b76fa6df9d337 Mon Sep 17 00:00:00 2001 From: arthurfiorette Date: Mon, 13 Dec 2021 17:44:06 -0300 Subject: [PATCH] chore: removed babel for node usage --- .babelrc | 9 --------- package.json | 5 +++-- tsconfig.types.json => tsconfig.build.json | 3 +-- tsconfig.json | 6 +++--- webpack.config.js | 6 ++++-- yarn.lock | 14 +++++++++++++- 6 files changed, 24 insertions(+), 19 deletions(-) delete mode 100644 .babelrc rename tsconfig.types.json => tsconfig.build.json (69%) diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 7563f250..00000000 --- a/.babelrc +++ /dev/null @@ -1,9 +0,0 @@ -// Config ignored by babel when running from webpack -{ - "presets": [ - ["@babel/preset-env", { "targets": "defaults" }], - "@babel/preset-typescript" - ], - "comments": false, - "compact": true -} diff --git a/package.json b/package.json index f8ecada3..ae2b4f01 100644 --- a/package.json +++ b/package.json @@ -8,9 +8,8 @@ "unpkg": "./dist/index.bundle.js", "scripts": { "build": "concurrently 'npm:build:*'", - "build:node": "babel src --out-dir dist --extensions '.ts' --ignore src/index.bundle.ts", "build:browser": "webpack", - "build:types": "tsc -p tsconfig.types.json", + "build:node": "tsc -p tsconfig.build.json", "test": "jest", "test:watch": "jest --watch", "test:coverage": "jest --coverage", @@ -51,8 +50,10 @@ "@babel/cli": "^7.16.0", "@babel/core": "^7.16.0", "@babel/plugin-transform-modules-commonjs": "^7.16.0", + "@babel/plugin-transform-runtime": "^7.16.4", "@babel/preset-env": "^7.16.4", "@babel/preset-typescript": "^7.16.0", + "@babel/runtime": "^7.16.3", "@types/jest": "^27.0.2", "@types/node": "^16.7.10", "@types/webpack": "^5.28.0", diff --git a/tsconfig.types.json b/tsconfig.build.json similarity index 69% rename from tsconfig.types.json rename to tsconfig.build.json index 75233a6f..63f941c9 100644 --- a/tsconfig.types.json +++ b/tsconfig.build.json @@ -1,8 +1,7 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "noEmit": false, - "emitDeclarationOnly": true + "noEmit": false }, "include": ["src"], "exclude": ["src/index.bundle.ts"] diff --git a/tsconfig.json b/tsconfig.json index 86edeaeb..2634437b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,7 @@ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ /* Language and Environment */ - "target": "ES2020" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, + "target": "ES6" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ @@ -45,10 +45,10 @@ "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */, "declarationMap": true /* Create sourcemaps for d.ts files. */, // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ - "sourceMap": true /* Create source map files for emitted JavaScript files. */, + // "sourceMap": true /* Create source map files for emitted JavaScript files. */, // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ "outDir": "./dist" /* Specify an output folder for all emitted files. */, - // "removeComments": true, /* Disable emitting comments. */ + "removeComments": true, /* Disable emitting comments. */ "noEmit": true, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ "importsNotUsedAsValues": "error" /* Specify emit/checking behavior for imports that are only used for types */, diff --git a/webpack.config.js b/webpack.config.js index 704a1bd2..d901c81b 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -27,7 +27,6 @@ const config = { rules: [ { test: /\.(ts|js)$/, - exclude: { and: [/node_modules/] }, use: { loader: 'babel-loader', options: { @@ -36,7 +35,10 @@ const config = { ['@babel/preset-env', { targets: 'defaults' }], '@babel/preset-typescript' ], - plugins: ['@babel/plugin-transform-modules-commonjs'] + plugins: [ + '@babel/plugin-transform-modules-commonjs', + '@babel/plugin-transform-runtime' + ] } } } diff --git a/yarn.lock b/yarn.lock index c2eb8fe6..33fdc3ba 100644 --- a/yarn.lock +++ b/yarn.lock @@ -739,6 +739,18 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-transform-runtime@^7.16.4": + version "7.16.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.16.4.tgz#f9ba3c7034d429c581e1bd41b4952f3db3c2c7e8" + integrity sha512-pru6+yHANMTukMtEZGC4fs7XPwg35v8sj5CIEmE+gEkFljFiVJxEWxx/7ZDkTK+iZRYo1bFXBtfIN95+K3cJ5A== + dependencies: + "@babel/helper-module-imports" "^7.16.0" + "@babel/helper-plugin-utils" "^7.14.5" + babel-plugin-polyfill-corejs2 "^0.3.0" + babel-plugin-polyfill-corejs3 "^0.4.0" + babel-plugin-polyfill-regenerator "^0.3.0" + semver "^6.3.0" + "@babel/plugin-transform-shorthand-properties@^7.16.0": version "7.16.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.16.0.tgz#090372e3141f7cc324ed70b3daf5379df2fa384d" @@ -899,7 +911,7 @@ "@babel/helper-validator-option" "^7.14.5" "@babel/plugin-transform-typescript" "^7.16.0" -"@babel/runtime@^7.8.4": +"@babel/runtime@^7.16.3", "@babel/runtime@^7.8.4": version "7.16.3" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.16.3.tgz#b86f0db02a04187a3c17caa77de69840165d42d5" integrity sha512-WBwekcqacdY2e9AF/Q7WLFUWmdJGJTkbjqTjoMDgXkVZ3ZRUvOPsLb5KdwISoQVsbP+DQzVZW4Zhci0DvpbNTQ==