update rollup config to fix breaking change in css.write

fix #58
fix https://github.com/rrweb-io/rrweb/issues/496
This commit is contained in:
Yanzhen Yu
2021-03-08 13:53:57 +08:00
parent 2982a55279
commit 6272f0f797
2 changed files with 21 additions and 12 deletions

View File

@@ -12,12 +12,24 @@ const production = !process.env.ROLLUP_WATCH;
const entries = (production const entries = (production
? [ ? [
{ file: pkg.module, format: 'es' }, { file: pkg.module, format: 'es', css: false },
{ file: pkg.main, format: 'cjs' }, { file: pkg.main, format: 'cjs', css: false },
{ file: pkg.unpkg, format: 'iife', name: 'rrwebPlayer' }, {
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) => ({ export default entries.map((output) => ({
input: 'src/main.ts', input: 'src/main.ts',
@@ -28,10 +40,7 @@ export default entries.map((output) => ({
dev: !production, dev: !production,
// we'll extract any component CSS out into // we'll extract any component CSS out into
// a separate file — better for performance // a separate file — better for performance
css: (css) => { css: output.css && ((css) => css.write(output.css)),
css.write('dist/style.css');
css.write('public/bundle.css');
},
preprocess: sveltePreprocess({ preprocess: sveltePreprocess({
postcss: { postcss: {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef

View File

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