From 5aa2c2d0cd6d60ab6ef69739d2c9d74c7ce73a78 Mon Sep 17 00:00:00 2001 From: matveyb Date: Sat, 23 Mar 2024 16:30:16 +0100 Subject: [PATCH] vanilla build init --- package.json | 4 ++++ rollup.config.ts | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 rollup.config.ts diff --git a/package.json b/package.json index 1d53c9c..0f2e70c 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,10 @@ "@types/events": "^3.0.0", "@typescript-eslint/eslint-plugin": "^5.31.0", "@typescript-eslint/parser": "^5.31.0", + "@rollup/plugin-typescript": "^10.0.1", + "@rollup/plugin-node-resolve": "^15.2.3", + "rollup-plugin-polyfill-node": "^0.13.0", + "rollup": "^3.9.0", "eslint": "^8.21.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-prettier": "^4.2.1", diff --git a/rollup.config.ts b/rollup.config.ts new file mode 100644 index 0000000..502f227 --- /dev/null +++ b/rollup.config.ts @@ -0,0 +1,53 @@ +import typescript from '@rollup/plugin-typescript'; +import terser from '@rollup/plugin-terser'; +import polyfillNode from 'rollup-plugin-polyfill-node'; +import nodeResolve from '@rollup/plugin-node-resolve'; +import commonjs from '@rollup/plugin-commonjs'; +import path from 'path'; + +const outDir = 'vanilla'; +const libName = 'everStandalone'; + +export default { + input: 'src/index.ts', + output: [ + { + format: 'iife', + name: libName, + file: path.join(outDir, 'everscale.js'), + globals: { + 'fast-safe-stringify': 'safeStringify', + 'everscale-inpage-provider': 'everscaleInpageProvider', + '@broxus/await-semaphore': 'awaitSemaphore', + }, + }, + { + format: 'iife', + name: libName, + file: path.join(outDir, 'everscale.min.js'), + plugins: [terser()], + globals: { + 'fast-safe-stringify': 'safeStringify', + 'everscale-inpage-provider': 'everscaleInpageProvider', + '@broxus/await-semaphore': 'awaitSemaphore', + }, + }, + ], + plugins: [ + polyfillNode(), + typescript({ + compilerOptions: { + module: 'esnext', + }, + outDir, + }), + commonjs({ + include: 'node_modules/**', + }), + nodeResolve({ + // pass custom options to the resolve plugin + moduleDirectories: ['node_modules'], + }), + ], + external: ['nekoton-wasm/nekoton_wasm_bg.wasm'], +};