2021-05-03 08:26:06 +02:00
|
|
|
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
|
|
|
|
import nodePolyfills from 'rollup-plugin-node-polyfills';
|
|
|
|
import babel from '@rollup/plugin-babel';
|
|
|
|
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
|
|
|
import commonjs from '@rollup/plugin-commonjs';
|
|
|
|
import replace from '@rollup/plugin-replace';
|
|
|
|
import image from '@rollup/plugin-image';
|
2019-04-16 09:38:15 +02:00
|
|
|
import postcss from 'rollup-plugin-postcss';
|
2021-05-12 13:38:30 +02:00
|
|
|
import { terser } from 'rollup-plugin-terser';
|
2021-05-03 08:26:06 +02:00
|
|
|
import packageJson from './package.json';
|
2019-04-15 18:35:01 +02:00
|
|
|
|
|
|
|
export default {
|
2019-04-16 09:38:15 +02:00
|
|
|
input: './lib/src/index.js',
|
2019-04-15 18:35:01 +02:00
|
|
|
output: [
|
|
|
|
{
|
2021-05-03 08:26:06 +02:00
|
|
|
file: packageJson.main,
|
2019-04-15 18:35:01 +02:00
|
|
|
format: 'cjs',
|
2021-05-03 14:58:54 +02:00
|
|
|
sourcemap: false,
|
2019-04-15 18:35:01 +02:00
|
|
|
},
|
|
|
|
{
|
2021-05-03 08:26:06 +02:00
|
|
|
file: packageJson.module,
|
|
|
|
format: 'esm',
|
2021-05-03 14:58:54 +02:00
|
|
|
sourcemap: false,
|
2019-04-15 18:35:01 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
plugins: [
|
2021-05-03 08:26:06 +02:00
|
|
|
peerDepsExternal({
|
|
|
|
packageJsonPath: './package.json',
|
|
|
|
}),
|
2019-04-16 09:38:15 +02:00
|
|
|
postcss({
|
2021-05-04 17:21:15 +02:00
|
|
|
modules: true,
|
|
|
|
minimize: true,
|
2021-05-03 08:26:06 +02:00
|
|
|
}),
|
|
|
|
nodeResolve({
|
|
|
|
extensions: ['.js'],
|
|
|
|
preferBuiltins: true,
|
|
|
|
}),
|
|
|
|
replace({
|
|
|
|
'process.env.NODE_ENV': JSON.stringify('production'),
|
|
|
|
preventAssignment: true,
|
2019-04-16 09:38:15 +02:00
|
|
|
}),
|
2019-04-15 18:35:01 +02:00
|
|
|
babel({
|
2021-05-03 08:26:06 +02:00
|
|
|
presets: [
|
|
|
|
[
|
|
|
|
'@babel/preset-env',
|
|
|
|
{
|
|
|
|
modules: false,
|
|
|
|
targets: {
|
|
|
|
browsers: ['Since 2017'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
'@babel/preset-react',
|
|
|
|
],
|
|
|
|
babelHelpers: 'runtime',
|
2021-05-04 09:01:09 +02:00
|
|
|
plugins: [
|
|
|
|
'@babel/plugin-transform-runtime',
|
|
|
|
'@babel/plugin-proposal-class-properties',
|
|
|
|
['babel-plugin-styled-components', { pure: true }],
|
|
|
|
],
|
2021-05-04 17:21:15 +02:00
|
|
|
extensions: ['.js', '.svg'],
|
2019-04-15 18:35:01 +02:00
|
|
|
exclude: 'node_modules/**',
|
|
|
|
}),
|
2019-04-16 09:38:15 +02:00
|
|
|
commonjs(),
|
2021-05-04 17:21:15 +02:00
|
|
|
image(),
|
2021-05-03 08:26:06 +02:00
|
|
|
nodePolyfills(),
|
2021-05-12 13:38:30 +02:00
|
|
|
terser(),
|
2021-05-03 08:26:06 +02:00
|
|
|
],
|
|
|
|
external: [
|
|
|
|
...Object.keys(packageJson.dependencies || {}),
|
|
|
|
...Object.keys(packageJson.peerDependencies || {}),
|
|
|
|
],
|
2019-04-15 18:35:01 +02:00
|
|
|
};
|