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: [
@ -17,12 +26,12 @@ export default [
format: 'umd',
name,
sourcemap: true,
globals:{
"@daotl/cryptico":"cryptico",
"@lifeomic/axios-fetch":"axiosFetch",
"axios":"axios",
"sm-crypto":"smCrypto"
}
globals: {
'@daotl/cryptico': 'cryptico',
'@lifeomic/axios-fetch': 'axiosFetch',
axios: 'axios',
'sm-crypto': 'smCrypto',
},
},
{ file: `${pkg.module}`, format: 'es', sourcemap: true },
{
@ -30,12 +39,12 @@ export default [
format: 'iife',
name,
sourcemap: true,
globals:{
"@daotl/cryptico":"cryptico",
"@lifeomic/axios-fetch":"axiosFetch",
"axios":"axios",
"sm-crypto":"smCrypto"
}
globals: {
'@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,18 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<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) {
document.write(`${string}\n\n`)
}
;(async () => {
; (async () => {
// const url = 'http://021.node.internetapi.cn:18010/SCIDE'
// const url = 'http://022.node.internetapi.cn:18010/SCIDE'
const url = 'http://041.node.internetapi.cn:21030/SCIDE/SCIDE'
@ -105,6 +108,8 @@
<link rel="icon" type="image/svg+xml" href="favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
</head>
<body></body>
</head>
<body></body>
</html>