0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

npmパッケージをビルドなしで読み込めるSkypackにおけるエラー解消

Posted at

Webページで利用していたSkypackのdebounceパッケージが読み込めずJSエラーになっていた。

main.js
import debounce from "https://cdn.skypack.dev/debounce";
https://cdn.skypack.dev/new/debounce@v2.2.0/dist=es2019
Failed to load resource: the server responded with a status of 500 ()

直接見に行ってみても下記のようなレスポンス。

Unexpected Error: Build was successful but could not be found.

gOZKgLNzxG6HPjgn9TCJ

パッケージは存在するし問題なさそうに見えるが、下記のような記事を見つけた。
バージョン指定をしないとリンクがうまくいかない問題があるようだ。

Skypackのページからnpmの本体githubをたどり、タグの中から最新の一個前のタグを探した。

最新のv2.2.0ではエラーになるので、

https://cdn.skypack.dev/debounce@v2.2.0

一個前のバージョンを指定。

https://cdn.skypack.dev/debounce@v2.1.1

読み込めた!

/*
 * Skypack CDN - debounce@2.1.1
 *
 * Learn more:
 *   📙 Package Documentation: https://www.skypack.dev/view/debounce
 *   📘 Skypack Documentation: https://www.skypack.dev/docs
 *
 * Pinned URL: (Optimized for Production)
 *   ▶️ Normal: https://cdn.skypack.dev/pin/debounce@v2.1.1-EM68BSwmpRS5T8tbaKya/mode=imports/optimized/debounce.js
 *   ⏩ Minified: https://cdn.skypack.dev/pin/debounce@v2.1.1-EM68BSwmpRS5T8tbaKya/mode=imports,min/optimized/debounce.js
 *
 */

// Browser-Optimized Imports (Don't directly import the URLs below in your application!)
export * from '/-/debounce@v2.1.1-EM68BSwmpRS5T8tbaKya/dist=es2019,mode=imports/optimized/debounce.js';
export {default} from '/-/debounce@v2.1.1-EM68BSwmpRS5T8tbaKya/dist=es2019,mode=imports/optimized/debounce.js';

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?