Skip to content

Commit 7aa05ff

Browse files
include React in tsx file and correct transpile issue
1 parent b67ae67 commit 7aa05ff

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

.babelrc.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,6 @@ const options = {
1616
],
1717
],
1818
plugins: [
19-
[
20-
'@babel/plugin-transform-typescript',
21-
{
22-
isTSX: true,
23-
allExtensions: true,
24-
},
25-
],
2619
'@babel/plugin-transform-react-jsx',
2720
[
2821
'transform-react-remove-prop-types',
@@ -35,7 +28,7 @@ const options = {
3528
env: {
3629
test: {
3730
// extra configuration for process.env.NODE_ENV === 'test'
38-
presets: ['@babel/env', '@babel/preset-typescript'], // overwrite env-config from above with transpiled module syntax
31+
presets: ['@babel/env'], // overwrite env-config from above with transpiled module syntax
3932
},
4033
},
4134
};

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
"watch": "set NODE_OPTIONS=--openssl-legacy-provider & cross-env BABEL_OUTPUT=umd INCLUDE_POLYFILLS=true webpack --config webpack.config.js --env=development --watch",
1919
"build": "set NODE_OPTIONS=--openssl-legacy-provider & npm-run-all clean:* --parallel build:lib:* & npm run build:dist",
2020
"build:dist": "rollup -c",
21-
"build:lib:cjs": "cross-env BABEL_OUTPUT=cjs babel src/ --out-dir lib/cjs/ --extensions .ts,.tsx --ignore **/__tests__,**/__mocks__,**/*.test.js,**/*.js.snap",
22-
"build:lib:esm": "babel src/ --out-dir lib/esm/ --extensions .ts,.tsx --ignore **/__tests__,**/__mocks__,**/*.test.js,**/*.js.snap",
23-
"build:lib:esm-pf": "cross-env INCLUDE_POLYFILLS=true babel src/ --out-dir lib/esm-including-polyfills/ --extensions .ts,.tsx --ignore **/__tests__,**/__mocks__,**/*.test.js,**/*.js.snap",
21+
"build:lib:cjs": "cross-env BABEL_OUTPUT=cjs babel src/ --out-dir lib/cjs/ --extensions .ts,.tsx --ignore **/__tests__,**/__mocks__,**/*.test.js,**/*.js.snap,**/*.d.ts",
22+
"build:lib:esm": "babel src/ --out-dir lib/esm/ --extensions .ts,.tsx --ignore **/__tests__,**/__mocks__,**/*.test.js,**/*.js.snap,**/*.d.ts",
23+
"build:lib:esm-pf": "cross-env INCLUDE_POLYFILLS=true babel src/ --out-dir lib/esm-including-polyfills/ --extensions .ts,.tsx --ignore **/__tests__,**/__mocks__,**/*.test.js,**/*.js.snap,**/*.d.ts",
2424
"clean:lib": "rimraf lib",
2525
"clean:dist": "rimraf dist",
2626
"prepublish": "npm run build",

src/strintToReact.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {useRef} from 'react';
1+
import React, {useRef} from 'react';
22
import PropTypes from 'prop-types';
33
function StringToReactComponent(deps: any, props: any) {
44
const {getCtx, Babel, react} = deps;

0 commit comments

Comments
 (0)