skypackjs / skypack-cdn

An issue tracker for the CDN
107 stars 5 forks source link

Default export overwritten with `export default null` in uint8arrays package #238

Open matheus23 opened 2 years ago

matheus23 commented 2 years ago

If you fetch https://cdn.skypack.dev/-/uint8arrays@v3.0.0-mW6EiV9yMHTASglPCv4L/dist=es2019,mode=imports/optimized/uint8arrays.js

It returns:

export {compare} from "./uint8arrays/compare.js";
export {concat} from "./uint8arrays/concat.js";
export {equals} from "./uint8arrays/equals.js";
export {fromString} from "./uint8arrays/from-string.js";
export {toString} from "./uint8arrays/to-string.js";
export {xor} from "./uint8arrays/xor.js";
import "./common/bases-af280048.js";
import "/-/multiformats@v9.4.9-X9RmvmemaBHVZWOdEh7E/dist=es2019,mode=imports/optimized/multiformats/basics.js";
export default null;

Even though the original file contained this:

import { compare } from './compare.js';
import { concat } from './concat.js';
import { equals } from './equals.js';
import { fromString } from './from-string.js';
import { toString } from './to-string.js';
import { xor } from './xor.js';
export {
  compare,
  concat,
  equals,
  fromString,
  toString,
  xor
};

This turned out to be an issue for us because skypack auto-generated a default import in our ucans package:

From https://cdn.skypack.dev/-/ucans@v0.8.0-hxyj6x7HmfQI7wj2tvlY/dist=es2019,mode=imports/optimized/ucans.js:

import require$$0 from "/-/uint8arrays@v3.0.0-mW6EiV9yMHTASglPCv4L/dist=es2019,mode=imports/optimized/uint8arrays.js";
import one_webcrypto_1 from "/-/one-webcrypto@v1.0.3-zOmMy3FwATGDwKyaYWtg/dist=es2019,mode=imports/optimized/one-webcrypto.js";
import require$$1 from "/-/tweetnacl@v1.0.3-G4yM3nQ8lnXXlGGQADqJ/dist=es2019,mode=imports/optimized/tweetnacl.js";
[...]

(require$$1 works fine, but require$$0 is null)