Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG https://cdn.skypack.dev/[email protected] not found #92

Open
pflagerd opened this issue Jan 15, 2023 · 5 comments
Open

BUG https://cdn.skypack.dev/[email protected] not found #92

pflagerd opened this issue Jan 15, 2023 · 5 comments

Comments

@pflagerd
Copy link

Please report bugs, rendering errors, CSS problems, cross-browser issues and so on here.
If you have found a mistake in the text, you can also report it here, although there's no need to report OS/browser details in that case.

Describe the bug
When performing "Download as Zip" from IDE, zipped site contains references to https://cdn.skynet.dev/[email protected] which does not exist. As of this date, references to https://cdn.skynet.dev/three produce 0.148.0 as the only option:

/*
 * Skypack CDN - [email protected]
 *
 * Learn more:
 *   📙 Package Documentation: https://www.skypack.dev/view/three
 *   📘 Skypack Documentation: https://www.skypack.dev/docs
 *
 * Pinned URL: (Optimized for Production)
 *   ▶️ Normal: https://cdn.skypack.dev/pin/[email protected]/mode=imports/optimized/three.js
 *   ⏩ Minified: https://cdn.skypack.dev/pin/[email protected]/mode=imports,min/optimized/three.js
 *
 */

// Browser-Optimized Imports (Don't directly import the URLs below in your application!)
export * from '/-/[email protected]/dist=es2019,mode=imports/optimized/three.js';
export {default} from '/-/[email protected]/dist=es2019,mode=imports/optimized/three.js';

To Reproduce
Steps to reproduce the behavior:

  1. From a browser, navigate to https://discoverthreejs.com/book/first-steps/first-scene/
  2. Click on the "Show IDE" icon in the far upper-left corner of the browser client area to make sure the IDE is visible:
    image
  3. From the IDE, click the "Download as Zip" icon:
    image
  4. When the download completes, you should have a file like the following in your Downloads/ directory:
    image
  5. Unzip the file and locate src/main.js. Observe that it contains an import statement as follows.
import {
  BoxBufferGeometry,
  Color,
  Mesh,
  MeshBasicMaterial,
  PerspectiveCamera,
  Scene,
  WebGLRenderer,
} from 'https://cdn.skypack.dev/[email protected]';
  1. Observe that the import refers to three version 0.136.2.
  2. From a browser, attempt to navigate to 'https://cdn.skypack.dev/[email protected]'
  3. Observe this message in your browser: Package "three" exists, but could not match version "0.136.2".

Expected behavior (optional)
Attempting to navigate to 'https://cdn.skypack.dev/[email protected]' should result in something like this in your browser:

image

Desktop (please complete the following information):

  • OS: Ubuntu Linux 22.04.1 LTS
  • Browser: Chrome
  • Version: 109.0.5414.74 (Official Build) (64-bit)

Additional context
Add any other context about the problem here.

@gisfinder
Copy link

the source file "vendor/three/build/three.module.js" is wrong.

@pflagerd pflagerd changed the title [BUG, ERROR] BUG https://cdn.skypack.dev/[email protected] not found Oct 22, 2023
@pflagerd
Copy link
Author

I agree that the source file "vendor/three/build/three.module.js" looks wrong. It looks like html. But I cannot find where it is referenced in the source code anywhere. In fact, after finding a fix for the cdn.skypack.dev version problem, I removed the vendor/ directory entirely and suffered no ill effects. Code appeared to work the same.

@pflagerd
Copy link
Author

I found that if I replaced 0.136.2 with 0.149.0, I could run MOST of the code examples. However, I also found a compatibility problem with the import in the controls.js file of those code examples that have controls.js (not all do).

import { OrbitControls} from 'https://cdn.skypack.dev/[email protected]/examples/jsm/controls/OrbitControls.js';

causes a Chrome/Chromium 118.0.5993.88 browser instance to complain in its console (and no scene is displayed) thus:

Uncaught TypeError: Failed to resolve module specifier "three". Relative references must start with either "/", "./", or "../".

Seems that the problem is somewhat unique to cdn.skypack.dev as replacing it with esm.sh or jspm.dev in the offending import results in the scene being correctly displayed.

e.g.

import { OrbitControls} from 'https://esm.sh/[email protected]/examples/jsm/controls/OrbitControls.js';

@pflagerd
Copy link
Author

pflagerd commented Oct 22, 2023

I guess I will work on replacing cdn.skypack.dev and changing the version number to 0.149.0 in my fork.

It would probably be wise to make it clear in the text of the site and/or the code examples themselves that we are using 0.149.0 which is not the most recent version.

@pflagerd
Copy link
Author

Also begs the question "How about examples which use the npm import style for running locally?"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants