Skip to content
Snippets Groups Projects
Select Git revision
  • 7830e3ab6c4210ad6eb2aba18cbe75b40ed1bbd8
  • 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.61 KiB
    import path from 'path';
    import resolve from 'rollup-plugin-node-resolve';
    import commonjs from 'rollup-plugin-commonjs';
    import multiEntry from 'rollup-plugin-multi-entry';
    import copy from 'rollup-plugin-copy';
    import serve from 'rollup-plugin-serve';
    import consts from 'rollup-plugin-consts';
    import url from "rollup-plugin-url";
    
    const pkg = require('./package.json');
    const build = (typeof process.env.BUILD !== 'undefined') ? process.env.BUILD : 'local';
    console.log("build: " + build);
    
    export default {
        input: (build !='test') ? 'demo.js' : 'test/**/*.js',
        output: {
            file: 'dist/bundle.js',
            format: 'esm'
        },
        plugins: [
            multiEntry(),
            consts({
                environment: build,
            }),
            resolve({
              customResolveOptions: {
                // ignore node_modules from vendored packages
                moduleDirectory: path.join(process.cwd(), 'node_modules')
              }
            }),
            commonjs({
                include: 'node_modules/**'
            }),
            url({
                limit: 0,
                include: [
                  "node_modules/bulma/**/*.css",
                  "node_modules/bulma/**/*.sass",
                ],
                emitFiles: true,
                fileName: 'shared/[name].[hash][extname]'
              }),
            copy({
                targets: [
                    {src: 'assets/index.html', dest: 'dist'},
                    {src: 'node_modules/material-design-icons-svg/paths/*.json', dest: 'dist/local/' + pkg.name + '/icons'},
                ],
            }),
            (process.env.ROLLUP_WATCH === 'true') ? serve({contentBase: 'dist', host: '127.0.0.1', port: 8002}) : false
        ]
    };