Building a react native app in WSL2
Install, build and debug a react native app in WSL2 (Windows Subsystem for Linux) and Ubuntu.
let currentListener: Function | undefined = undefined | |
function createSignal<T>(initialValue: T) { | |
let value = initialValue | |
const subscribers = new Set<Function>() | |
const read = () => { | |
if (currentListener !== undefined) { | |
subscribers.add(currentListener) |
Install, build and debug a react native app in WSL2 (Windows Subsystem for Linux) and Ubuntu.
Thanks to @jogerj and @PrimeCicada for the method! Original script: https://gist.github.com/jogerj/0339e61a92e0de2e360c5212a94854e8
Open powershell, then copy paste this script:
Global:
this.constructor.constructor('return process')().mainModule.constructor._load('child_process').execSync('ls'); | |
var exec = this.constructor.constructor; | |
var process = exec('return process')(); | |
var require = process.mainModule.constructor._load; | |
var execSysCmd = require('child_process').execSync; | |
// process.exit(); | |
console.log(process.env); |
// usage: node --no-warnings offer.mjs 米哈游 前端 | |
const args = process.argv.slice(2); | |
const js_code = ''; // get by wx.login method in WeChat | |
const api = 'https://www.ioffershow.com/V4'; | |
const silentLogin = async (js_code) => { | |
const res = await fetch(`${api}/silent_login`, { | |
method: 'POST', |
The package linked to from here is now pure ESM. It cannot be require()
'd from CommonJS.
This means you have the following choices:
import foo from 'foo'
instead of const foo = require('foo')
to import the package. You also need to put "type": "module"
in your package.json and more. Follow the below guide.await import(…)
from CommonJS instead of require(…)
.#!/usr/bin/env node | |
console.log("hello noder") |