oraoto / pib

PHP in Browser (powered by WebAssembly)
https://oraoto.github.io/pib/
Apache License 2.0
953 stars 109 forks source link

RuntimeError: abort(RuntimeError: abort(both async and sync fetching of the wasm failed) #61

Open kenorb opened 2 years ago

kenorb commented 2 years ago

I'm trying to load PhpWeb in NextJS app, but it's failing as below:

Unhandled Runtime Error
RuntimeError: abort(RuntimeError: abort(both async and sync fetching of the wasm failed). Build with -s ASSERTIONS=1 for more info.). Build with -s ASSERTIONS=1 for more info.

Call Stack
abort
node_modules/php-wasm/php-web.js (9:11689)
eval
node_modules/php-wasm/php-web.js (9:13352)

Version: php-wasm@0.0.4-b

I'm loading <Drupal/> component by:

const Drupal = dynamic(() => import("../components/Drupal"), {ssr: false});

where Drupal class is defined as:

export default class Drupal extends React.Component {
    constructor(props) {
        super(props);
    }

    componentDidUpdate(prevProps, prevState) {
    }

    async componentDidMount() {
        const PhpWeb = (await import('php-wasm/PhpWeb')).PhpWeb;
        const php = new PhpWeb;
    }

    render() {
        return (
            <div className={styles.drupal}>
                Drupal
            </div>
        )
    }
}

Any ideas why this error happens? In php-web.js file?