From d7290bf750a5c136b56c159c33fa2fd972aa6acb Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 12 Jan 2022 17:14:52 +0100 Subject: [PATCH] remove exports field to try and prevent vite bug resolving asset url downside is that we can't export cjs version anymore --- scripts/sdk/base-manifest.json | 11 ++--------- scripts/sdk/create-manifest.js | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 11 deletions(-) mode change 100755 => 100644 scripts/sdk/create-manifest.js diff --git a/scripts/sdk/base-manifest.json b/scripts/sdk/base-manifest.json index bc8919fb..666cc2b9 100644 --- a/scripts/sdk/base-manifest.json +++ b/scripts/sdk/base-manifest.json @@ -2,14 +2,7 @@ "name": "hydrogen-view-sdk", "description": "Embeddable matrix client library, including view components", "version": "0.0.2", - "main": "./hydrogen.cjs.js", - "exports": { - ".": { - "import": "./hydrogen.es.js", - "require": "./hydrogen.cjs.js" - }, - "./paths/vite": "./paths/vite.js", - "./style.css": "./style.css" - }, "types": "types/lib.d.ts" + "main": "./hydrogen.es.js", + "type": "module" } diff --git a/scripts/sdk/create-manifest.js b/scripts/sdk/create-manifest.js old mode 100755 new mode 100644 index 7a01de0a..cf2e360c --- a/scripts/sdk/create-manifest.js +++ b/scripts/sdk/create-manifest.js @@ -1,7 +1,22 @@ #!/usr/bin/env node const fs = require("fs"); -const appManifest = require("../../package.json") -const baseSDKManifest = require("./base-manifest.json") +const appManifest = require("../../package.json"); +const baseSDKManifest = require("./base-manifest.json"); +/* + need to leave exports out of base-manifest.json because of #vite-bug, + with the downside that we can't support environments that support + both esm and commonjs modules, so we pick just esm. + ``` + "exports": { + ".": { + "import": "./hydrogen.es.js", + "require": "./hydrogen.cjs.js" + }, + "./paths/vite": "./paths/vite.js", + "./style.css": "./style.css" + }, + ``` +*/ const mergeOptions = require('merge-options'); const manifestExtension = {