Skip to content

Extensible Rollup configuration#183

Merged
jaredpalmer merged 9 commits into
masterfrom
v0.9
Aug 26, 2019
Merged

Extensible Rollup configuration#183
jaredpalmer merged 9 commits into
masterfrom
v0.9

Conversation

@jaredpalmer

@jaredpalmer jaredpalmer commented Aug 22, 2019

Copy link
Copy Markdown
Owner

Closes #110

You can now extend the rollup config via tsdx.config.js.

Now you can do this....

// tsdx.config.js
const postcss = require('rollup-plugin-postcss');
const autoprefixer = require('autoprefixer');
const cssnano = require('cssnano');

module.exports = {
  rollup(config, options) {
    config.plugins.push(
      postcss({
        plugins: [
          autoprefixer(),
          cssnano({
            preset: 'default',
          }),
        ].filter(Boolean),
        // only write out CSS for the first bundle (avoids pointless extra files):
        inject: false,
        extract: options.writeMeta,
      })
    );
    return config;
  },
};

@jaredpalmer jaredpalmer requested a review from swyxio August 22, 2019 20:58
@jaredpalmer jaredpalmer changed the title V0.9 Extensible Rollup configuration Aug 22, 2019
@swyxio

swyxio commented Aug 26, 2019

Copy link
Copy Markdown
Collaborator

got some time to check this out. so extractErrors changes from a string to boolean. i feel like i can argue pros and cons of that but you've probably thought this through (my guess is the string isn't all that reusable anyway so we dont really lose anything by dropping it to a boolean). either way i'll update some parts of the docs that fell out of date w this pr

@swyxio

swyxio commented Aug 26, 2019

Copy link
Copy Markdown
Collaborator

getting "Sourcemap is likely to be incorrect: a plugin was used to transform files, but didn't generate a sourcemap for the transformation. Consult the plugin documentation for help"

this issue comes from rollup and has been seen in rollup-plugin-babel but i'm not sure if its related to our tsdx babel plugin. tagging @Andarist in case they can take a look

@Andarist

Copy link
Copy Markdown

rollup-plugin-babel should generate source maps by default, unless you turn it off - https://github.com/rollup/rollup-plugin-babel/blob/4d8c0c570e35200c3456372494d1029a4e2a2a90/src/index.js#L20

@jaredpalmer

Copy link
Copy Markdown
Owner Author

Merge and release?

@swyxio

swyxio commented Aug 26, 2019

Copy link
Copy Markdown
Collaborator

yup im good w that

@designorant

Copy link
Copy Markdown

Could we consider extending rollup-plugin-typescript2 configuration in the same way babel one can be extended?

I've been looking into adding assents into my library via @svgr/rollup which led me to: ezolenko/rollup-plugin-typescript2#105

The fix seems to be to pass the objectHashIgnoreUnknownHack: true option to rpt but that isn't quite possible in tsdx unless I'm missing something.

@swyxio

swyxio commented Sep 5, 2019

Copy link
Copy Markdown
Collaborator

open separate issue with suggestion of what api you’d like to see please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

extend rollup configuration

4 participants