Skip to content

Commit

Permalink
update ssr build
Browse files Browse the repository at this point in the history
  • Loading branch information
josefaidt committed May 21, 2021
1 parent 75c0009 commit e94a72d
Showing 1 changed file with 19 additions and 30 deletions.
49 changes: 19 additions & 30 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,25 @@ import resolve from '@rollup/plugin-node-resolve'
import sveld from 'sveld'
import pkg from './package.json'

const name = pkg.name
.replace(/^(@\S+\/)?(svelte-)?(\S+)/, '$3')
.replace(/^\w/, m => m.toUpperCase())
.replace(/-\w/g, m => m[1].toUpperCase())
export default ['es', 'umd'].map(format => {
const UMD = format === 'umd'

const svelteConfig = {
input: pkg.svelte,
output: [
{ file: pkg.module, format: 'es' },
{ file: pkg.main, format: 'umd', name },
],
external: Object.keys(pkg.dependencies),
plugins: [
svelte({
emitCss: false,
compilerOptions: {
generate: 'ssr',
},
}),
resolve(),
sveld(),
],
}
const svelteConfig = {
emitCss: false,
}

// const preprocessConfig = {
// input: 'support/preprocess.js',
// output: [
// { file: './lib/preprocess.mjs', format: 'es' },
// { file: './lib/preprocess.js', format: 'cjs' },
// ],
// }
if (UMD) {
svelteConfig.compilerOptions = { generate: 'ssr' }
}

export default [svelteConfig]
return {
input: pkg.svelte,
output: {
file: UMD ? pkg.main : pkg.module,
format,
name: UMD ? pkg.name : undefined,
},
external: Object.keys(pkg.dependencies),
plugins: [svelte(svelteConfig), resolve(), UMD && sveld()],
}
})

0 comments on commit e94a72d

Please sign in to comment.