Skip to content

Commit

Permalink
Did not run properly as es module under node
Browse files Browse the repository at this point in the history
  • Loading branch information
Lars-Erik Roald committed Apr 5, 2022
1 parent bdd70ca commit e4035b0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
5 changes: 4 additions & 1 deletion index.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
void !function() {
typeof self === 'undefined' && typeof global === 'object'
? global.self = global : null;
}();var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};

function getAugmentedNamespace(n) {
if (n.__esModule) return n;
Expand Down
9 changes: 9 additions & 0 deletions merge.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const fs = require('fs').promises;

async function merge() {
let data1 = await fs.readFile('./self.js');
let data2 = await fs.readFile('./index.mjs');
await fs.writeFile('./index.mjs', data1 + data2);
}

merge();
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rdb-client",
"version": "1.2.15",
"version": "1.2.16",
"description": "Rdb in the browser",
"main": "./index.cjs",
"exports": {
Expand All @@ -20,7 +20,8 @@
"rdb": "bin/rdb.js"
},
"scripts": {
"build": "rollup -c rollup.config.js",
"concat": "node merge.js",
"build": "rollup -c rollup.config.js && npm run concat",
"test": "eslint ./ && jest",
"coveralls": "jest --coverage && cat ./coverage/lcov.info | coveralls",
"lint": "eslint ./",
Expand Down
4 changes: 4 additions & 0 deletions self.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
void !function() {
typeof self === 'undefined' && typeof global === 'object'
? global.self = global : null;
}();

0 comments on commit e4035b0

Please sign in to comment.