Search code examples
javascriptwebpackecmascript-6babeljsrollup

How to configure Roll-up Babel's plugin


I have created a rollup project. I wasn't able to use rollup -c && rollup -c --environment PRODUCTION without using less than two files :

Some people told me on freenode I should only have one file.

I wan't to be able to run the following code with rollup:

src/index.js

export default true;

src/tests/index.test.js

import demo from '../index';

describe('demo test', () => {
  it('should return true', () => {
    expect(demo).toBe(true);
  });
});

I couldn't find any logical explanation on what plugin should be in what file, all I know is I wasn't able to make it work with only one configuration.


Solution

  • For the rollup-plugin-babel you can specify babelrc: false to tell it to ignore your .babelrc file, then specify the plugins and presets parameters in your rollup.config.js.

    If you included the code for your rollup.config.js and .babelrc files, I could be more specific.