Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extensible Rollup configuration #183

Merged
merged 9 commits into from
Aug 26, 2019
Merged

Extensible Rollup configuration #183

merged 9 commits into from
Aug 26, 2019

Conversation

jaredpalmer
Copy link
Owner

@jaredpalmer jaredpalmer commented Aug 22, 2019

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 changed the title V0.9 Extensible Rollup configuration Aug 22, 2019
@swyxio
Copy link
Collaborator

swyxio commented Aug 26, 2019

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
Copy link
Collaborator

swyxio commented Aug 26, 2019

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

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
Owner Author

Merge and release?

@swyxio
Copy link
Collaborator

swyxio commented Aug 26, 2019

yup im good w that

@designorant
Copy link

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
Copy link
Collaborator

swyxio commented Sep 5, 2019

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