Cannot find modules
See original GitHub issueBug Report
Overview
I get the error, TypeError: WebAssembly Instantiation: Import #0 module="utils" error: module is not an object or function
. I assume there is something I need to do to make these available, but I could not find anything in the docs.
Expected
Should import modules like log
from the env
module, as shown in the simple Walt Explorer examples and quick start guide.
Actual
TypeError - can’t resolve modules.
Example
Versions
Node.js: v8.10 Webpack: 4.15.1 walt-loader: 1.0.21
import { log: LogType } from 'env'; // also tried 'console' here
type LogType = (i32) => void;
Webpack config:
const path = require('path')
module.exports = {
resolve: {
extensions: [".walt", ".js", ".css"]
},
module: {
rules: [
{ test: /\.walt$/, use: 'walt-loader' },
{
test: /\.js$/,
exclude: /node_modules/,
use: "babel-loader"
},
{ test: /\.css$/, use: ['style-loader', 'css-loader'] }
]
},
entry: './src/index.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
}
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
How do I resolve "Cannot find module" error using Node.js?
This happens when a first npm install has crashed for some reason (SIGINT of npm), or that the delay was too long, or...
Read more >Error: cannot find module [Node npm Error Solved]
How to Fix the "cannot find module" Error · delete the node modules folder by running rm -rf node_modules · delete package.lock.json file...
Read more >How to resolve "Cannot find module" error in Node
The Cannot find module error is a common error that usually happens when dependencies are not installed. Once you install your dependencies and ......
Read more >How to resolve can't find module error in Node.js
To fix Cannot find module errors, install the modules properly by running a npm install command in the appropriate directory as your project's ......
Read more >Cannot find module 'X' error in Node.js
To solve the "Cannot find module" error in Node.js, make sure to install the package from the error message if it's a third-party...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It still runs int the JavaScript sandbox, think of it as if you linked a .dll into your executable. You can call the methods imported but you don’t change how they are written/executed.
There is even a slight penalty for crossing that wasm <> js boundary (in either direction) as the engine has to perform validation and security(?) checks. I think Firefox at least has worked around some of these speed bumps though.
@ballercat didn’t want to open a new issue for this, because it’s just a random question. a response is not urgent.
if i were to import a javascript library to use in walt (such as importing
console.log
in your example), would the performance be the same as if i ran it in JS? i.e, these imported JS library are still run in a JS environment right? I would assume so.thinking wishfully - It would be super cool if I could import something like
lodash
and have it perform like WASM.