Skip to content

Commit 25d65ab

Browse files
committed
browser is a const
1 parent 871825c commit 25d65ab

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

.babelrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{"plugins": ["static-fs"]}
2+

index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ global.formatString = (object) => object !== undefined ? JSON.stringify(object)
1818

1919
const mp = require('./lib/micropython.js');
2020
if (typeof webpackJsonp !== 'object') {
21-
browser = false;
2221
pyjs = require('fs').readFileSync(__dirname + '/js.py').toString();
2322
}
2423
else {

lib/micropython.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,11 @@ var mainProgram = function()
7676

7777
Module["onRuntimeInitialized"] = mainProgram;
7878

79-
if (typeof webpackJsonp !== 'object') {
80-
const file = require('fs').readFileSync(__dirname + '/micropython.binary');
79+
if (true) { //typeof webpackJsonp !== 'object') {
80+
const fs = require('fs')
81+
const path = require('path')
82+
console.log(fs)
83+
const file = fs.readFileSync(__dirname + '/micropython.binary');
8184
Module.emterpreterFile = file.buffer.slice(file.byteOffset, file.byteOffset + file.byteLength);
8285
}
8386
else {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"homepage": "https://github.com/rafi16jan/micropython-wasm#readme",
2828
"dependencies": {
2929
"arraybuffer-loader": "^1.0.7",
30+
"babel-plugin-static-fs": "^1.2.0",
3031
"node-fetch": "^2.6.0",
3132
"raw-loader": "^2.0.0"
3233
}

0 commit comments

Comments
 (0)