refactor(examples): use rollup instead of cra/webpack #817

This commit is contained in:
moklick
2021-01-05 15:18:04 +01:00
parent 4cb558403c
commit 9169bd766d
11 changed files with 172 additions and 26030 deletions
+45 -47
View File
@@ -12,51 +12,49 @@ import pkg from './package.json';
const isProd = process.env.NODE_ENV === 'production';
const processEnv = isProd ? 'production' : 'development';
export default [
{
input: 'src/index.ts',
external: ['react', 'react-dom', /@babel\/runtime/],
onwarn(warning, rollupWarn) {
if (warning.code !== 'CIRCULAR_DEPENDENCY') {
rollupWarn(warning);
}
},
output: [
{
file: pkg.main,
format: 'cjs',
sourcemap: true,
exports: 'named',
},
{
file: pkg.module,
format: 'esm',
sourcemap: true,
exports: 'named',
},
],
plugins: [
replace({
__ENV__: JSON.stringify(processEnv),
__REACT_FLOW_VERSION__: JSON.stringify(pkg.version),
}),
bundleSize(),
postcss({
minimize: isProd,
}),
babel({
exclude: 'node_modules/**',
babelHelpers: 'runtime',
}),
svgr(),
typescript({
clean: true,
}),
resolve(),
commonjs({
include: 'node_modules/**',
}),
],
export default {
input: 'src/index.ts',
external: ['react', 'react-dom', /@babel\/runtime/],
onwarn(warning, rollupWarn) {
if (warning.code !== 'CIRCULAR_DEPENDENCY') {
rollupWarn(warning);
}
},
];
output: [
{
file: pkg.main,
format: 'cjs',
sourcemap: true,
exports: 'named',
},
{
file: pkg.module,
format: 'esm',
sourcemap: true,
exports: 'named',
},
],
plugins: [
replace({
__ENV__: JSON.stringify(processEnv),
__REACT_FLOW_VERSION__: JSON.stringify(pkg.version),
}),
bundleSize(),
postcss({
minimize: isProd,
}),
babel({
exclude: 'node_modules/**',
babelHelpers: 'runtime',
}),
svgr(),
typescript({
clean: true,
}),
resolve(),
commonjs({
include: 'node_modules/**',
}),
],
};