Closed Arno-62 closed 6 months ago
That’s because to run code in a browser, you need to use a bundler (or be using import maps and only native ESM that only uses universal features).
Webpack is a common one; you can google for tutorials.
Thanks for your rapid feedback. I will look into Webpack.
Details
I have installed 3 packages using npm and everything appears to be OK (node_modules directory, package.json, package-lock.json). However, when I use the "import" command in a javascript code given below, it does not work. If I un-comment any of the three "import" commands, the code does not work (I do not get the alert message).
Node.js version
v20.5.1
Example code
This far.
Operating system
Ubuntu 22.04
Scope
Runtime problem due to problem with package installation.
Module and version
npm version10.2.5