How to use the sapper/config/rollup.client function in sapper

To help you get started, we’ve selected a few sapper examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alexdilley / sapper-serverless-template / rollup.config.js View on Github external
const aliases = alias({
  resolve: extensions.reduce((acc, ext) => [...acc, ext, `/index${ext}`], []),
  '@': path.resolve(__dirname, 'src'),
});
const preprocess = sveltePreprocess({ postcss: true });

// eslint-disable-next-line no-shadow
const onwarn = (warning, onwarn) =>
  (warning.code === 'CIRCULAR_DEPENDENCY' &&
    warning.message.includes('/@sapper/')) ||
  onwarn(warning);

export default {
  client: {
    input: config.client.input(),
    output: config.client.output(),
    plugins: [
      aliases,
      replace({
        'process.browser': true,
        'process.env.NODE_ENV': JSON.stringify(mode),
      }),
      svelte({
        dev,
        hydratable: true,
        preprocess,
        emitCss: true,
      }),
      resolve({ browser: true, extensions }),
      commonjs(),
      !dev && terser({ module: true }),
    ],
github alexdilley / sapper-serverless-template / rollup.config.js View on Github external
const extensions = ['.mjs', '.js', '.svelte', '.css'];
const aliases = alias({
  resolve: extensions.reduce((acc, ext) => [...acc, ext, `/index${ext}`], []),
  '@': path.resolve(__dirname, 'src'),
});
const preprocess = sveltePreprocess({ postcss: true });

// eslint-disable-next-line no-shadow
const onwarn = (warning, onwarn) =>
  (warning.code === 'CIRCULAR_DEPENDENCY' &&
    warning.message.includes('/@sapper/')) ||
  onwarn(warning);

export default {
  client: {
    input: config.client.input(),
    output: config.client.output(),
    plugins: [
      aliases,
      replace({
        'process.browser': true,
        'process.env.NODE_ENV': JSON.stringify(mode),
      }),
      svelte({
        dev,
        hydratable: true,
        preprocess,
        emitCss: true,
      }),
      resolve({ browser: true, extensions }),
      commonjs(),
      !dev && terser({ module: true }),