prettierfy rollup configs

pull/618/head
Rich Harris 8 years ago
parent 84595fb381
commit 66e4c7307a

@ -4,22 +4,25 @@ import commonjs from 'rollup-plugin-commonjs';
import json from 'rollup-plugin-json'; import json from 'rollup-plugin-json';
import typescript from 'rollup-plugin-typescript'; import typescript from 'rollup-plugin-typescript';
const src = path.resolve( 'src' ); const src = path.resolve('src');
export default { export default {
entry: 'src/index.ts', entry: 'src/index.ts',
moduleName: 'svelte', moduleName: 'svelte',
targets: [ targets: [{ dest: 'compiler/svelte.js', format: 'umd' }],
{ dest: 'compiler/svelte.js', format: 'umd' }
],
plugins: [ plugins: [
{ {
resolveId ( importee, importer ) { resolveId(importee, importer) {
// bit of a hack — TypeScript only really works if it can resolve imports, // bit of a hack — TypeScript only really works if it can resolve imports,
// but they misguidedly chose to reject imports with file extensions. This // but they misguidedly chose to reject imports with file extensions. This
// means we need to resolve them here // means we need to resolve them here
if ( importer && importer.startsWith( src ) && importee[0] === '.' && path.extname( importee ) === '' ) { if (
return path.resolve( path.dirname( importer ), `${importee}.ts` ); importer &&
importer.startsWith(src) &&
importee[0] === '.' &&
path.extname(importee) === ''
) {
return path.resolve(path.dirname(importer), `${importee}.ts`);
} }
} }
}, },
@ -29,7 +32,7 @@ export default {
typescript({ typescript({
include: 'src/**', include: 'src/**',
exclude: 'src/shared/**', exclude: 'src/shared/**',
typescript: require( 'typescript' ) typescript: require('typescript')
}) })
], ],
sourceMap: true sourceMap: true

@ -6,9 +6,7 @@ import buble from 'rollup-plugin-buble';
export default { export default {
entry: 'src/server-side-rendering/register.js', entry: 'src/server-side-rendering/register.js',
moduleName: 'svelte', moduleName: 'svelte',
targets: [ targets: [{ dest: 'ssr/register.js', format: 'cjs' }],
{ dest: 'ssr/register.js', format: 'cjs' }
],
plugins: [ plugins: [
nodeResolve({ jsnext: true, module: true }), nodeResolve({ jsnext: true, module: true }),
commonjs(), commonjs(),
@ -20,9 +18,9 @@ export default {
} }
}) })
], ],
external: [ path.resolve( 'src/index.ts' ), 'fs', 'path' ], external: [path.resolve('src/index.ts'), 'fs', 'path'],
paths: { paths: {
[ path.resolve( 'src/index.ts' ) ]: '../compiler/svelte.js' [path.resolve('src/index.ts')]: '../compiler/svelte.js'
}, },
sourceMap: true sourceMap: true
}; };

Loading…
Cancel
Save