Skip to content
Snippets Groups Projects
Select Git revision
  • d48edcd327479e7a230e1a34684f251a5cd47337
  • master default protected
  • 2018ws
  • 2017ws
  • 2016ws
5 results

functions-03.c

Blame
  • Forked from Peter Gerwinski / hp
    Source project has a limited visibility.
    esbuild.dev.mjs 773 B
    import * as esbuild from 'esbuild';
    
    // Fetch 'RELATIVE_URL_ROOT' ENV variable value while removing any trailing slashes.
    const relativeUrlRoot = (process.env.RELATIVE_URL_ROOT || '').replace(/\/*$/, '');
    
    await esbuild.build({
      entryPoints: ['app/javascript/main.jsx'],
      bundle: true,
      sourcemap: true,
      outdir: 'app/assets/builds',
      loader: {
        '.png': 'dataurl',
        '.svg': 'text',
      },
      watch: {
        onRebuild: (error, result) => {
          if (error) console.error('watch build failed:', error);
          else console.log('watch build succeeded:', result);
        },
      },
      define: {
        'process.env.RELATIVE_URL_ROOT': `"${relativeUrlRoot}"`,
        'process.env.OMNIAUTH_PATH': `"${relativeUrlRoot}/auth/openid_connect"`,
      },
    });
    
    console.log('watch build started');