Skip to content

Commit

Permalink
remove polyfill & change require to import
Browse files Browse the repository at this point in the history
  • Loading branch information
peng committed Mar 8, 2024
1 parent 033ade5 commit 138cb15
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 37 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
"@rollup/plugin-node-resolve": "15.2.3",
"@rollup/plugin-terser": "0.4.4",
"pako": "2.1.0",
"rollup-plugin-polyfill-node": "0.13.0",
"rollup": "4.9.2"
}
}
27 changes: 0 additions & 27 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import commonjs from '@rollup/plugin-commonjs';
import nodePolyfills from 'rollup-plugin-polyfill-node';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import pkg from './package.json' assert {type: 'json'};
Expand All @@ -18,7 +17,6 @@ export default [
},
plugins: [
commonjs(),
nodePolyfills(),
nodeResolve(),
terser()
]
Expand All @@ -34,7 +32,6 @@ export default [
},
plugins: [
commonjs(),
nodePolyfills(),
nodeResolve(),
terser()
]
Expand Down
8 changes: 2 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
// import * as fs from 'node:fs'
// import { randomFillSync } from'node:crypto'

if (typeof window === 'undefined') {
// const nodeCrypto = require("crypto");
global.crypto = {
async getRandomValues(b) {
const { randomFillSync } = await import('node:crypto')
const { randomFillSync } = await import('crypto')
randomFillSync(b);
}
};
Expand Down Expand Up @@ -571,7 +567,7 @@ export async function init(wasmPath) {
var buffer;
if (typeof window === 'undefined') {
global.excelize = {};
const fs = await import('node:fs')
const fs = await import('fs')
buffer = pako.ungzip(fs.readFileSync(wasmPath));
} else {
window.excelize = {};
Expand Down

0 comments on commit 138cb15

Please sign in to comment.