I have some public react page or component that want to share these component across all project. is it possible to share? I am trying to use Microbundle to do, seems these tool only share some ts lib, I added the package config follow the https://github.com/developit/microbundle like this:
{
"name": "rd-component",
"type": "module",
"source": "src/index.tsx",
"exports": {
"require": "./dist/foo.cjs",
"default": "./dist/foo.modern.js"
},
"main": "./dist/foo.cjs",
"module": "./dist/foo.module.js",
"unpkg": "./dist/foo.umd.js",
"scripts": {
"build": "microbundle",
"dev": "microbundle watch"
},
"devDependencies": {
"microbundle": "^0.15.1"
}
}
when I compile, show error like this:
rpt2: options error TS5089: Option 'jsxFactory' cannot be specified when option 'jsx' is 'react-jsx'.
rpt2: options error TS5089: Option 'jsxFragmentFactory' cannot be specified when option 'jsx' is 'react-jsx'.
(rpt2 plugin) Error: /Users/xiaoqiangjiang/source/reddwarf/frontend/rd-component/src/component/demo/CommonPage.tsx(1,19): semantic error TS2307: Cannot find module 'react' or its corresponding type declarations.
Error: /Users/xiaoqiangjiang/source/reddwarf/frontend/rd-component/src/component/demo/CommonPage.tsx(1,19): semantic error TS2307: Cannot find module 'react' or its corresponding type declarations.
at error (/Users/xiaoqiangjiang/source/reddwarf/frontend/rd-component/node_modules/rollup/dist/shared/rollup.js:198:30)
at throwPluginError (/Users/xiaoqiangjiang/source/reddwarf/frontend/rd-component/node_modules/rollup/dist/shared/rollup.js:21718:12)
at Object.error (/Users/xiaoqiangjiang/source/reddwarf/frontend/rd-component/node_modules/rollup/dist/shared/rollup.js:22672:20)
at Object.error (/Users/xiaoqiangjiang/source/reddwarf/frontend/rd-component/node_modules/rollup/dist/shared/rollup.js:21895:42)
at RollupContext.error (/Users/xiaoqiangjiang/source/reddwarf/frontend/rd-component/node_modules/microbundle/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:20259:30)
at /Users/xiaoqiangjiang/source/reddwarf/frontend/rd-component/node_modules/microbundle/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:29527:23
at Array.forEach (<anonymous>)
at printDiagnostics (/Users/xiaoqiangjiang/source/reddwarf/frontend/rd-component/node_modules/microbundle/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:29500:17)
at Object.transform (/Users/xiaoqiangjiang/source/reddwarf/frontend/rd-component/node_modules/microbundle/node_modules/rollup-plugin-typescript2/dist/rollup-plugin-typescript2.cjs.js:29785:17)
at /Users/xiaoqiangjiang/source/reddwarf/frontend/rd-component/node_modules/rollup/dist/shared/rollup.js:22879:40
is it possible to fixed this issue? I have already tried to install dependencies:
npm install microbundle react react-dom --save-dev