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

No 'exports.__esModule = true;' inside of generated cjs files #4297

Closed
Filyus opened this issue Mar 4, 2021 · 1 comment
Closed

No 'exports.__esModule = true;' inside of generated cjs files #4297

Filyus opened this issue Mar 4, 2021 · 1 comment
Labels

Comments

@Filyus
Copy link

@Filyus Filyus commented Mar 4, 2021

Swiper 6.4.15

Files, generated by Svelte don't contain the line exports.__esModule = true;

  • node_modules\swiper\cjs\svelte\swiper.js
  • node_modules\swiper\cjs\svelte\swiper-slide.js
class Swiper extends SvelteComponent {
  //...
}
//exports.__esModule = true; //missing
exports.default = Swiper;

Therefore _interopRequireDefault() in node_modules\swiper\swiper-svelte.cjs.js returns .default.default property instead of simple.default:

function _interopRequireDefault(obj) {
  return obj && obj.__esModule ? obj : {
    default: obj
  };
}

var _swiper = _interopRequireDefault(require("./cjs/svelte/swiper"));
exports.Swiper = _swiper.default;

var _swiperSlide = _interopRequireDefault(require("./cjs/svelte/swiper-slide"));
exports.SwiperSlide = _swiperSlide.default;

Possible solutions:

  1. (Dirty) Add swiper += '\nexports.__esModule = true;';
    and swiperSlide += '\nexports.__esModule = true;';
    before await fs.writeFile ... in swiper/scripts/build-svelte.js
  2. Or change _interopRequireDefault() in node_modules\swiper\swiper-svelte.cjs.js to check .default instead of .__esModule:
function _interopRequireDefault(obj) {
  return obj && obj.default ? obj : {
    default: obj
  };
}
@Filyus
Copy link
Author

@Filyus Filyus commented Mar 17, 2021

I still have this issue... (v6.5.0)

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

No branches or pull requests

1 participant