From 6860569f1989b4866c644f14d76c90474bb734c1 Mon Sep 17 00:00:00 2001 From: mderrier Date: Fri, 20 Nov 2020 12:32:44 +0100 Subject: [PATCH 1/2] fix(build): output es5 --- .babelrc | 7 +++++++ package.json | 8 ++++---- rollup.config.js | 4 ++-- scripts/build.sh | 4 ++++ 4 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 .babelrc diff --git a/.babelrc b/.babelrc new file mode 100644 index 000000000..7316d0483 --- /dev/null +++ b/.babelrc @@ -0,0 +1,7 @@ +{ + "presets": [["@babel/env", { + "targets": { + "browsers": ["> 0.5%"] + } + }]] +} diff --git a/package.json b/package.json index 6005f9f8a..f1524c327 100644 --- a/package.json +++ b/package.json @@ -58,10 +58,7 @@ "node": ">=12.0.0" }, "browserslist": [ - "> 1%", - "last 2 versions", - "maintained node versions", - "not dead" + "> 0.5%" ], "author": "Arno Gourdol ", "contributors": [ @@ -84,6 +81,8 @@ "paosder " ], "devDependencies": { + "@babel/cli": "7.12.1", + "@babel/preset-env": "7.12.1", "@babel/types": "^7.12.6", "@cortex-js/prettier-config": "^1.0.0", "@rollup/plugin-node-resolve": "^10.0.0", @@ -93,6 +92,7 @@ "@typescript-eslint/eslint-plugin": "^4.7.0", "@typescript-eslint/parser": "^4.7.0", "@typescript-eslint/typescript-estree": "^4.7.0", + "acorn-private-class-elements": "0.2.7", "autoprefixer": "^9.8.6", "check-node-version": "^4.0.3", "cssnano": "^4.1.10", diff --git a/rollup.config.js b/rollup.config.js index 5cb82c47f..10fec33d1 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -189,7 +189,7 @@ const ROLLUP = [ { format: 'umd', name: 'MathLive', - file: `${BUILD_DIRECTORY}/mathlive.js`, + file: `${BUILD_DIRECTORY}/mathlive.es6.js`, sourcemap: !PRODUCTION, exports: 'named', }, @@ -256,7 +256,7 @@ if (PRODUCTION) { { format: 'umd', name: 'MathLive', - file: `${BUILD_DIRECTORY}/mathlive.min.js`, + file: `${BUILD_DIRECTORY}/mathlive.min.es6.js`, sourcemap: false, }, ], diff --git a/scripts/build.sh b/scripts/build.sh index 6b0d64627..cf50a5b8a 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -92,6 +92,10 @@ else printf "\033[32m ● \033[0m Making a \033[33m%s\033[0m build" "$BUILD" npx rollup --silent --config echo -e "\033[2K\033[80D\033[32m ✔ \033[33m" $BUILD "\033[0m build done" + + printf "\033[32m ● \033[0m Making a \033[33m%s\033[0m build es5 " "$BUILD" + npx babel -o dist/mathlive.js dist/mathlive.es6.js + echo -e "\033[2K\033[80D\033[32m ✔ \033[33m" $BUILD "\033[0m build es5 done" if [ "$BUILD" = "production" ]; then # Optimize CSS From 10b3f5c7454c5d0948933e1d05274e17f0c0d0bc Mon Sep 17 00:00:00 2001 From: mderrier Date: Fri, 20 Nov 2020 12:36:42 +0100 Subject: [PATCH 2/2] fix(build): add gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b8f8014d9..d1e8bc34e 100755 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,7 @@ babel.babel TODO.md examples/basic/index.debug.html - +dist/* # To store secret credentials *.secret.js