From 708854614274be275908eb06aeb118c1b204b969 Mon Sep 17 00:00:00 2001 From: Mauricio Astudillo Toledo Date: Mon, 19 Aug 2024 11:22:00 -0400 Subject: [PATCH 1/2] chore: add configuration for module generation --- package.json | 2 +- webpack.config.js | 64 +++++++++++++++++++++++++++++++---------------- 2 files changed, 43 insertions(+), 23 deletions(-) diff --git a/package.json b/package.json index 3829bca..a61788c 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "description": "SDK Web Transbank POS", "main": "dist/pos.js", - "module": "dist/pos.js", + "module": "dist/pos.esm.js", "types": "dist/pos.d.ts", "scripts": { "start": "webpack --watch --config webpack.config.js", diff --git a/webpack.config.js b/webpack.config.js index 562e0c9..c18b519 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,31 +1,51 @@ -const path = require('path'); -const CopyWebpackPlugin = require('copy-webpack-plugin'); +const path = require("path"); +const CopyWebpackPlugin = require("copy-webpack-plugin"); module.exports = [ - 'source-map' -].map(devtool => ({ - mode: 'production', - entry: './src/pos.js', + { + mode: "production", + entry: "./src/pos.js", output: { - path: path.resolve(__dirname, 'dist'), - filename: 'pos.js', - library: 'Transbank', - libraryTarget: 'window', - umdNamedDefine: true + path: path.resolve(__dirname, "dist"), + filename: "pos.js", + library: "Transbank", + libraryTarget: "commonjs2", + umdNamedDefine: true, }, module: { - rules: [ - ] + rules: [ + ], }, - devtool, + devtool: "source-map", optimization: { - minimize: true + minimize: true, }, plugins: [ - new CopyWebpackPlugin({ - patterns: [ - { from: 'types', to: '.' } - ] - }) - ] -})); + new CopyWebpackPlugin({ + patterns: [{ from: "types", to: "." }], + }), + ], + }, + { + mode: "production", + entry: "./src/pos.js", + output: { + path: path.resolve(__dirname, "dist"), + filename: "pos.esm.js", + library: { + type: "module", + }, + }, + module: { + rules: [ + ], + }, + devtool: "source-map", + optimization: { + minimize: true, + }, + experiments: { + outputModule: true, + } + }, +]; From c058f25174e969c958c97a8ee5a28c7ebd71d725 Mon Sep 17 00:00:00 2001 From: Mauricio Astudillo Toledo Date: Mon, 19 Aug 2024 11:22:39 -0400 Subject: [PATCH 2/2] chore: delete unused babel configuration file --- babel.config.json | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 babel.config.json diff --git a/babel.config.json b/babel.config.json deleted file mode 100644 index 225972f..0000000 --- a/babel.config.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "presets": [ - [ - "@babel/env", - { - "targets": { - "ie": "10", - "edge": "17", - "firefox": "60", - "chrome": "58", - "safari": "11.1" - }, - "useBuiltIns": "entry", - "corejs": "3.6.4" - } - ] - ] -}