svelte-docs icon indicating copy to clipboard operation
svelte-docs copied to clipboard

Upgrade rollup to v2

Open shirotech opened this issue 5 years ago • 6 comments

Seems we are still in v1, and it's quite hard adding my own plugins and configurations to the build. Having said that it requires updating some of the existing plugins that you have as there are some breaking changes. For that, I'll really need your help on that one, hope you're happy to do it. Many thanks 😄

shirotech avatar May 24 '20 19:05 shirotech

Rollup using by @svelte-docs/core only. Users can't use their own rollup.config.js. What existing plugins you want to use and how? To move on Rollup2 we should rewrite huge amount builtin plugins in core but as I say in https://github.com/AlexxNB/svelte-docs/issues/20, I'm going to rewrite core and rewriting plugins in this package may bu useless thing right now

AlexxNB avatar May 24 '20 20:05 AlexxNB

Example this is my rollup.config.js

import {htmlResolver, resolvePlugins} from '...';
import conf from '@svelte-docs/core/rollup.config';

const extraPlugins = resolvePlugins(['resolver', 'conf'], {resolver: htmlResolver});
conf[0].plugins.unshift(...extraPlugins); // injecting plugins to main
conf[1].plugins.unshift(...extraPlugins); // injecting plugins to example

conf.push({something}); // this part here breaks, as v1 doesn't support code splitting using object in input

export default conf;

e.g. v1 doesn't support this kind of configuration https://rollupjs.org/guide/en/#input

// rollup.config.js
export default {
  ...,
  input: {
    a: 'src/main-a.js',
    'b/index': 'src/main-b.js'
  },
  output: {
    ...,
    entryFileNames: 'entry-[name].js'
  }
};

To move on Rollup2 we should rewrite huge amount builtin plugins in core but as I say in #20, I'm going to rewrite core and rewriting plugins in this package may bu useless thing right now

If that's the case, I'll look for an alternative solution.

shirotech avatar May 24 '20 20:05 shirotech

It is tricky and undocumented =) You may check core plugins, if there are not so much changes and you have a time for test this, feel free to PR.

AlexxNB avatar May 24 '20 20:05 AlexxNB

I feel bad hacking the project, but really need it to build using the builtin ***example which imports directly from a component, but that said component requires additional steps etc.

Cool, I'll see if I can upgrade it cleanly, last time I did it wasn't too bad. Will PR later this week as a heads up. Cheers.

shirotech avatar May 24 '20 20:05 shirotech

what about a move to snowpack?

jmsunseri avatar Jan 25 '21 10:01 jmsunseri

Yeah! I'm waiting for release to see if it is possible to recreate svelte-docs with svelte-kit.

AlexxNB avatar Jan 25 '21 11:01 AlexxNB