Skip to content

Commit

Permalink
update rollup config to fix breaking change in css.write
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuyz0112 committed Mar 8, 2021
1 parent 2982a55 commit 6272f0f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
25 changes: 17 additions & 8 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,24 @@ const production = !process.env.ROLLUP_WATCH;

const entries = (production
? [
{ file: pkg.module, format: 'es' },
{ file: pkg.main, format: 'cjs' },
{ file: pkg.unpkg, format: 'iife', name: 'rrwebPlayer' },
{ file: pkg.module, format: 'es', css: false },
{ file: pkg.main, format: 'cjs', css: false },
{
file: pkg.unpkg,
format: 'iife',
name: 'rrwebPlayer',
css: 'style.css',
},
]
: []
).concat([{ file: 'public/bundle.js', format: 'iife', name: 'rrwebPlayer' }]);
).concat([
{
file: 'public/bundle.js',
format: 'iife',
name: 'rrwebPlayer',
css: 'bundle.css',
},
]);

export default entries.map((output) => ({
input: 'src/main.ts',
Expand All @@ -28,10 +40,7 @@ export default entries.map((output) => ({
dev: !production,
// we'll extract any component CSS out into
// a separate file — better for performance
css: (css) => {
css.write('dist/style.css');
css.write('public/bundle.css');
},
css: output.css && ((css) => css.write(output.css)),
preprocess: sveltePreprocess({
postcss: {
// eslint-disable-next-line no-undef
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1186,10 +1186,10 @@ rollup-plugin-livereload@^1.0.0:
dependencies:
livereload "^0.9.1"

rollup-plugin-svelte@^5.0.3:
version "5.2.3"
resolved "https://registry.npmjs.org/rollup-plugin-svelte/-/rollup-plugin-svelte-5.2.3.tgz#efdc15e3e3fdd9b9f1100fdc14a8532b4e587bc8"
integrity sha512-513vOht9A93OV7fvmpIq8mD1JFgTZ5LidmpULKM2Od9P1l8oI5KwvO32fwCnASuVJS1EkRfvCnS7vKQ8DF4srg==
rollup-plugin-svelte@^6.1.1:
version "6.1.1"
resolved "https://registry.yarnpkg.com/rollup-plugin-svelte/-/rollup-plugin-svelte-6.1.1.tgz#66362cf0500fb7a848283ebcf19d289a60ef0871"
integrity sha512-ijnm0pH1ScrY4uxwaNXBpNVejVzpL2769hIEbAlnqNUWZrffLspu5/k9/l/Wsj3NrEHLQ6wCKGagVJonyfN7ow==
dependencies:
require-relative "^0.8.7"
rollup-pluginutils "^2.8.2"
Expand Down

0 comments on commit 6272f0f

Please sign in to comment.