chore: build axios-fetch for test

This commit is contained in:
Nex Zhu 2023-03-18 19:55:44 +08:00
parent ec5099762e
commit 92129afd38
No known key found for this signature in database
GPG Key ID: 15C6254AD19362B4
3 changed files with 134 additions and 120 deletions

View File

@ -43,7 +43,6 @@
"prettier": "^2.7.1",
"rollup": "^2.79.1",
"rollup-plugin-dts": "^4.2.2",
"@rollup/plugin-node-resolve": "^15.0.1",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.34.1",
"shx": "^0.3.4",

View File

@ -1,14 +1,23 @@
import type { RollupOptions } from '@rollup'
import commonjs from '@rollup/plugin-commonjs'
import dts from 'rollup-plugin-dts'
import { terser } from 'rollup-plugin-terser'
import typescript from 'rollup-plugin-typescript2'
import commonjs from '@rollup/plugin-commonjs'
const pkg = require('./package.json')
const name = 'bdcontract'
export default [
{
input: 'node_modules/@lifeomic/axios-fetch/src/index.js',
output: {
file: 'dist/axios-fetch.iife.js',
format: 'iife',
name: 'axiosFetch',
},
plugins: [commonjs()],
},
{
input: 'src/index.ts',
output: [
@ -18,11 +27,11 @@ export default [
name,
sourcemap: true,
globals: {
"@daotl/cryptico":"cryptico",
"@lifeomic/axios-fetch":"axiosFetch",
"axios":"axios",
"sm-crypto":"smCrypto"
}
'@daotl/cryptico': 'cryptico',
'@lifeomic/axios-fetch': 'axiosFetch',
axios: 'axios',
'sm-crypto': 'smCrypto',
},
},
{ file: `${pkg.module}`, format: 'es', sourcemap: true },
{
@ -31,11 +40,11 @@ export default [
name,
sourcemap: true,
globals: {
"@daotl/cryptico":"cryptico",
"@lifeomic/axios-fetch":"axiosFetch",
"axios":"axios",
"sm-crypto":"smCrypto"
}
'@daotl/cryptico': 'cryptico',
'@lifeomic/axios-fetch': 'axiosFetch',
axios: 'axios',
'sm-crypto': 'smCrypto',
},
},
],
plugins: [
@ -43,7 +52,8 @@ export default [
tsconfig: 'tsconfig.build.json',
useTsconfigDeclarationDir: true,
}),
terser(),commonjs()
terser(),
commonjs(),
],
},
{

View File

@ -1,11 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<!-- <script src="../node_modules/cross-fetch/dist/cross-fetch.js"></script> -->
<script src="../lib/index.js"></script>
<script src="./sm2.js"></script>
<script src="./cryptico.iife.js"></script>
<script src="https://unpkg.com/axios@1.3.4/dist/axios.min.js"></script>
<script src="../dist/axios-fetch.iife.js"></script>
<script src="../lib/index.js"></script>
<!-- <script src="../dist/bdcontract-sdk.iife.js"></script> -->
<script>
function print(string) {
@ -106,5 +109,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
</head>
<body></body>
</html>