can't get import to work #69
Unanswered
joshmackay
asked this question in
Q&A
Replies: 2 comments
-
Are you running that JS file directly in the browser, or do you have some build step in between? |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'm assuming you aren't using any bundler but just a straight html file. In that case using a CDN like this might be easier to get you started without too much fiddling with es modules.
If you don't want to use a CDN, Parcel is nice for a little basic project. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I am having trouble getting this package to work. I have made a basic project and I cannot get the import to work in my JS file.
This is my JS file which works fine in the browser until I add the import line at the top.
`import { createNoise2D } from "simplex-noise";
function setup() {
createCanvas(400, 400);
noLoop();
}
function draw() {
background(220);
}`
I added the "type" : "module", line to my package.json and added type="module" to my html script tag for the JS file. This is the error I am left with....
Failed to resolve module specifier "simplex-noise". Relative references must start with either "/", "./", or "../".
Any ideas? I'm completely lost
Beta Was this translation helpful? Give feedback.
All reactions