Skip to content
Snippets Groups Projects
Select Git revision
  • 86f29a8d08710bebb39babf5c41e993976a87879
  • main default protected
  • renovate/lock-file-maintenance
  • demo protected
  • person-select-custom
  • dbp-translation-component
  • icon-set-mapping
  • port-i18next-parser
  • remove-sentry
  • favorites-and-recent-files
  • revert-6c632dc6
  • lit2
  • advertisement
  • wc-part
  • automagic
  • publish
  • wip-cleanup
  • demo-file-handling
18 results

rollup.config.js

Blame
  • rollup.config.js 1.63 KiB
    import glob from 'glob';
    import resolve from '@rollup/plugin-node-resolve';
    import commonjs from '@rollup/plugin-commonjs';
    import copy from 'rollup-plugin-copy';
    import serve from 'rollup-plugin-serve';
    import del from 'rollup-plugin-delete';
    import json from '@rollup/plugin-json';
    import {getPackagePath, getDistPath} from '../../rollup.utils.js';
    
    const build = (typeof process.env.BUILD !== 'undefined') ? process.env.BUILD : 'local';
    console.log("build: " + build);
    
    export default (async () => {
        return {
            input: (build !='test') ? ['src/dbp-app-shell.js', 'src/dbp-activity-example.js'] : glob.sync('test/**/*.js'),
            output: {
                dir: 'dist',
                entryFileNames: '[name].js',
                chunkFileNames: 'shared/[name].[hash].[format].js',
                format: 'esm',
                sourcemap: true
              },
            plugins: [
                del({
                    targets: 'dist/*'
                  }),
                resolve(),
                commonjs(),
                json(),
                copy({
                    targets: [
                        {src: 'assets/silent-check-sso.html', dest:'dist'},
                        {src: 'assets/index.html', dest: 'dist'},
                        {src: 'assets/*.json', dest: 'dist'},
                        {src: await getPackagePath('@dbp-toolkit/common', 'assets/icons/*.svg'), dest: 'dist/' + await getDistPath('@dbp-toolkit/common', 'icons')},
                    ],
                }),
                (process.env.ROLLUP_WATCH === 'true') ? serve({
                    contentBase: 'dist',
                    historyApiFallback: '/index.html',
                    host: '127.0.0.1', port: 8002}) : false
            ]
        }
    })();