From 6baa3cd74d40dd556aaee546b8117d7b7680b4da Mon Sep 17 00:00:00 2001 From: Christoph Reiter <reiter.christoph@gmail.com> Date: Wed, 18 Nov 2020 17:26:02 +0100 Subject: [PATCH] rollup: switch to the babel output plugin Instead of transforming the input we now transform the output. This has the downside that we can't share the helpers and duplicate them per chunk, but also makes sure we cover all code that ends up in the bundle. Also move terser aft er babel, so it gets minified last. --- rollup.config.js | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/rollup.config.js b/rollup.config.js index 343261e..eb2295f 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -14,7 +14,7 @@ import consts from 'rollup-plugin-consts'; import license from 'rollup-plugin-license'; import del from 'rollup-plugin-delete'; import emitEJS from 'rollup-plugin-emit-ejs' -import babel from '@rollup/plugin-babel' +import {getBabelOutputPlugin} from '@rollup/plugin-babel'; import selfsigned from 'selfsigned'; // ------------------------------- @@ -281,7 +281,6 @@ Dependencies: replace({ "process.env.BUILD": '"' + build + '"', }), - useTerser ? terser() : false, copy({ targets: [ {src: 'assets/silent-check-sso.html', dest:'dist'}, @@ -307,14 +306,7 @@ Dependencies: {src: 'node_modules/tabulator-tables/dist/css', dest: 'dist/local/@dbp-toolkit/file-handling/tabulator-tables'}, ], }), - useBabel && babel({ - include: [ - 'src/**', - 'vendor/**', - 'node_modules/pdfjs-dist/**', // uses Promise.allSettled - ], - babelHelpers: 'runtime', - babelrc: false, + useBabel && getBabelOutputPlugin({ presets: [[ '@babel/preset-env', { loose: true, @@ -325,15 +317,8 @@ Dependencies: } } ]], - plugins: [[ - '@babel/plugin-transform-runtime', { - corejs: 3, - useESModules: true - } - ], - '@babel/plugin-syntax-dynamic-import', - '@babel/plugin-syntax-import-meta'] }), + useTerser ? terser() : false, watch ? serve({ contentBase: '.', host: '127.0.0.1', -- GitLab