Commit 1b75b6ab by xuzhenzhao

chore(custom): add babel to transform mathjs

parent e8f0d8f8
{
"presets": [
[
"@babel/preset-env",
{
"useBuiltIns": "entry",
"corejs": "3.22",
"targets": {
"chrome": "58",
"ie": "11"
}
}
]
]
}
\ No newline at end of file
...@@ -38,7 +38,10 @@ ...@@ -38,7 +38,10 @@
"regenerator-runtime": "^0.13.9" "regenerator-runtime": "^0.13.9"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.18.10",
"@babel/preset-env": "^7.18.10",
"@jest/globals": "^28.1.3", "@jest/globals": "^28.1.3",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^22.0.2", "@rollup/plugin-commonjs": "^22.0.2",
"@rollup/plugin-json": "^4.1.0", "@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.3.0", "@rollup/plugin-node-resolve": "^13.3.0",
......
...@@ -2,6 +2,7 @@ import typescript from 'rollup-plugin-typescript2' ...@@ -2,6 +2,7 @@ import typescript from 'rollup-plugin-typescript2'
import json from '@rollup/plugin-json'; import json from '@rollup/plugin-json';
import commonjs from '@rollup/plugin-commonjs'; import commonjs from '@rollup/plugin-commonjs';
import {nodeResolve} from '@rollup/plugin-node-resolve'; import {nodeResolve} from '@rollup/plugin-node-resolve';
import { babel } from '@rollup/plugin-babel';
export default [ export default [
{ {
...@@ -14,6 +15,9 @@ export default [ ...@@ -14,6 +15,9 @@ export default [
typescript() typescript()
] ]
}, },
/**
* umd 版本兼容es5
*/
{ {
input: 'src/index.ts', input: 'src/index.ts',
output: { output: {
...@@ -23,11 +27,12 @@ export default [ ...@@ -23,11 +27,12 @@ export default [
}, },
plugins: [ plugins: [
typescript(), typescript(),
commonjs(),
json(),
nodeResolve({ nodeResolve({
dedupe: ['mathjs'] dedupe: ['mathjs']
}) }),
commonjs(),
json(),
babel()
] ]
} }
] ]
\ No newline at end of file
export { Payment } from './Payment/Payment' export {Payment} from './Payment/Payment'
\ No newline at end of file \ No newline at end of file
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
/* Language and Environment */ /* Language and Environment */
"target": "es5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ "target": "es6", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
"lib": ["es5", "DOM"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ "lib": ["esnext", "DOM"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "jsx": "preserve", /* Specify what JSX code is generated. */ // "jsx": "preserve", /* Specify what JSX code is generated. */
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
...@@ -54,9 +54,9 @@ ...@@ -54,9 +54,9 @@
"outDir": "./dist", /* Specify an output folder for all emitted files. */ "outDir": "./dist", /* Specify an output folder for all emitted files. */
// "removeComments": true, /* Disable emitting comments. */ // "removeComments": true, /* Disable emitting comments. */
// "noEmit": true, /* Disable emitting files from a compilation. */ // "noEmit": true, /* Disable emitting files from a compilation. */
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment