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

feat: add esm build #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bin/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ lerna version minor --no-push --yes
lerna exec --parallel -- rm -rf dist

lerna exec --parallel -- rollup -c ../../rollup.config.js
lerna exec --parallel -- rollup -c ../../rollup.config.esm.js

lerna exec --parallel -- cp package.json dist/package.json
lerna exec --parallel -- cp ../../README.md dist/README.md
Expand Down
9 changes: 7 additions & 2 deletions packages/logo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@
"react": "^16.13.0 || ^17.0.1",
"react-dom": "^16.13.0 || ^17.0.1"
},
"main": "./index.js",
"module": "./esm/index.js",
"main": "./dist",
"module": "./dist/esm",
"types": "./dist/*.d.ts",
"sifeEffects": false,
"files": [
"./dist"
],
"publishConfig": {
"access": "public"
}
Expand Down
33 changes: 33 additions & 0 deletions rollup.config.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import pkg from './package.json';
import resolve from '@rollup/plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';
import typescript from '@rollup/plugin-typescript';
import multiInput from 'rollup-plugin-multi-input';

export default {
input: 'src/**/*.tsx',
output: [
{
dir: 'dist/esm',
format: 'es',
plugins: [terser()],
},
],
plugins: [
resolve(),
typescript({
allowSyntheticDefaultImports: true,
jsx: 'react',
target: 'es6',
outDir: './dist/esm',
rootDir: './src',
removeComments: true,
strict: true,
}),
multiInput(),
],
external: [
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
],
};