Does anyone use Webstorm and three.js? It appears not to work.

I am not normally a javascript programmer. I just want to try three.js.Using Webstorm as my IDE I try the simplest example using the CDN reference, but Webstorm seems to have no concept of using a URL.

<script type="module">
    import * as THREE from 'https://unpkg.com/three@0.126.1/build/three.module.js';
</script>

It flags the url as if it was a missing directory tree.

Previously I tried using npm to fetch three.js and while that worked for Webstorm to do code completion, it of course fails to work in a browser so I went down the road to Webpack, babel etc but that’s way too much effort just to try three.js. What is the simplest thing I can do just to try even the most basic example.

This issue is not really three.js related. So maybe it would be a good move to open an issue at webstorm.
I recommend using visual code as an IDE. Works very well for me on Windows and Mac and is free

1 Like
npm init @vitejs/app my-three-app
cd my-three-app
npm install
npm install three
npm run dev

you have a production-ready environment by that point. imo there is nothing that will cost you more effort than trying to make esm work, which is merely a spec. you can’t use dependencies with esm, the problem you’re trying to solve is only a foretaste of what’s to come.

you don’t need IDE’s for JS otherwise. VSC is a formidable editor.