Using rollup to build react library
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "react-jsx",
"baseUrl": "src",
// generate types file .d.ts and put it under types folder
"declaration": true,
"declarationDir": "./types",
"sourceMap": true,
},
"include": [
"**/*.ts",
"**/*.tsx"
]
}Personally, i think rollup is more suitable to build a library instead of webpack, as its related library is popular, the required customization is smaller and more developer-friendly, but also easier to build different version of js
Last updated
Was this helpful?