morkro/vue-a11y-dialog

1.1.0 build issue from esm

roblevintennis opened this issue · 6 comments

I'm having trouble building 1.1.0 and consuming from AgnosticUI's agnostic-vue package. Let me provide some context…

To test the 1.1.0 PR I did as mentioned here:
#31 (comment)

For posterity this was that tester's package.json:

{
  "name": "package_test",
  "version": "0.0.0",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview"
  },
  "dependencies": {
    "vue": "^3.2.25",
    "vue-a11y-dialog": "file:../vue-a11y-dialog-v1.1.0.tgz"
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "^2.0.0",
    "vite": "^2.7.2"
  }
}

This works fine.

However, I've tried to consume my PR's topic branch late last night and ran into an issue which appears to be some sort of UMD inside an ESM env issue.

I'm going to try to experiment with the vite.config.js build setup and package.json pointers as well. Something must be off.

Here's errors as both image and text for posterity…

image

This is caused by consumer doing:
import { Vue3A11yDialog } from "vue-a11y-dialog";

yarn dev

changed 1 package, and audited 38 packages in 961ms

3 packages are looking for funding
  run `npm fund` for details

1 moderate severity vulnerability

To address all issues, run:
  npm audit fix

Run `npm audit` for details.
yarn run v1.22.17
warning package.json: No license field
$ vite
Pre-bundling dependencies:
  vue
  agnostic-vue
(this will be run only when your dependencies or config have changed)
 > node_modules/agnostic-vue/dist/agnostic-vue.esm.js:1:7: error: No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "default"
    1 │ import require$$0, { openBlock, createElementBlock, normalizeClass, rend...
      ╵        ~~~~~~~~~~

error when starting dev server:
Error: Build failed with 1 error:
node_modules/agnostic-vue/dist/agnostic-vue.esm.js:1:7: error: No matching export in "node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "default"
    at failureErrorWithLog (/Users/roblevin/workspace/opensource/agnosticui/agnostic-vue/examples/node_modules/esbuild/lib/main.js:1493:15)
    at /Users/roblevin/workspace/opensource/agnosticui/agnostic-vue/examples/node_modules/esbuild/lib/main.js:1151:28
    at runOnEndCallbacks (/Users/roblevin/workspace/opensource/agnosticui/agnostic-vue/examples/node_modules/esbuild/lib/main.js:941:63)
    at buildResponseToResult (/Users/roblevin/workspace/opensource/agnosticui/agnostic-vue/examples/node_modules/esbuild/lib/main.js:1149:7)
    at /Users/roblevin/workspace/opensource/agnosticui/agnostic-vue/examples/node_modules/esbuild/lib/main.js:1258:14
    at /Users/roblevin/workspace/opensource/agnosticui/agnostic-vue/examples/node_modules/esbuild/lib/main.js:629:9
    at handleIncomingPacket (/Users/roblevin/workspace/opensource/agnosticui/agnostic-vue/examples/node_modules/esbuild/lib/main.js:726:9)
    at Socket.readFromStdout (/Users/roblevin/workspace/opensource/agnosticui/agnostic-vue/examples/node_modules/esbuild/lib/main.js:596:7)
    at Socket.emit (node:events:390:28)
    at addChunk (node:internal/streams/readable:315:12)
error Command failed with exit code 1.

I've updated package.json config to reflect Vite documentation (see below). Perhaps that is solving the issue?

Edit: Oops, wrong thread. I was referring to your comment in the last PR.

@morkro no worries here is fine. That patch you linked does look promising. Let me take some time to test and verify that locally and get right back.

@morkro just trying being super clear and putting back here on the ticket — recommending:

  • close #33
  • review #35
  • if there's a better temp branch then main for that to go in point it there (1.1.0 has tons of conflicts probably due to previous merge)
  • then of course you'll cut a new 1.1.0 release as you see fit :)

Thanks for the work @roblevintennis :) Why don't you clone this repository, create a new branch from the 1.1.0 branch, and contribute the fix in there. Then open a PR against this one.

Then we don't have to close the other PR again and don't need to re-do all the other changes. Merging (and keeping up to date with upstream) from a different origin is always a bit chaotic IMO :D

Otherwise I can also simply identify the changes you made and copy them over to the 1.1.0 branch tomorrow morning.

Either way, we're getting there! Looks like a new release tomorrow morning :)

Thanks @morkro -- re

Why don't you clone this repository, create a new branch from the 1.1.0 branch

This is going to be too hairy I think since it was so unstable. Perhaps it'll be easier to identify changes but what I'd recommend is to move the previous 1.1.0 branch to something like 1.1.0-old so you can preserve your work for reference (although I thought I got your stuff in but good to have in case). Recreate 1.1.0 fresh off of main, then we can redirect this PR here to 1.1.0 again without the crazy amount of conflicts and get a clean merge. Then cross reference against 1.1.0-old if you'd like.

Alternatively and if you prefer, you could cut a 1.1.0-next or something and I can point to there. That might be fine for you anyway since I'm sure you're going to still want to have a look and do some small commits and what not before you cut a release proper.

Yes, we're getting close I think 👍

Think we can close this discussion here and continue in the respective PRs (#36 and #33)