-
Notifications
You must be signed in to change notification settings - Fork 9
Fix errors when importing the package in a DOMless environment (e.g. Node) #115
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
Conversation
This fixes the following error I'm getting when building my Next.js app that uses this package: ``` my-app:build: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /Users/benface/my-app/node_modules/style-observer/package.json my-app:build: at exportsNotFound (node:internal/modules/esm/resolve:314:10) my-app:build: at packageExportsResolve (node:internal/modules/esm/resolve:604:13) my-app:build: at resolveExports (node:internal/modules/cjs/loader:657:36) my-app:build: at Function._findPath (node:internal/modules/cjs/loader:749:31) my-app:build: at Function.<anonymous> (node:internal/modules/cjs/loader:1387:27) my-app:build: at /Users/benface/my-app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/server/require-hook.js:55:36 my-app:build: at Function.resolve (node:internal/modules/helpers:145:19) my-app:build: at _resolve (/Users/benface/my-app/node_modules/.pnpm/[email protected]/node_modules/jiti/dist/jiti.js:1:246378) my-app:build: at jiti (/Users/benface/my-app/node_modules/.pnpm/[email protected]/node_modules/jiti/dist/jiti.js:1:249092) ```
This actually prevents an error, not when building in Next, but when running tests with Vitest and jsdom…
Co-authored-by: Lea Verou <[email protected]>
Co-authored-by: Lea Verou <[email protected]>
Co-authored-by: Dmitry Sharabin <[email protected]>
Co-authored-by: Dmitry Sharabin <[email protected]>
✅ Deploy Preview for style-observer ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
@LeaVerou @DmitrySharabin – The following issues from the previous PR are still unresolved:
Let me know if I'm missing anything, and if you want me to work on the above (I know @LeaVerou wanted to work on it too). Thank you! |
Thanks! @benface should I commit directly or send a PR against this branch? |
Feel free to commit directly! Thank you so much. |
Co-authored-by: Dmitry Sharabin <[email protected]>
@LeaVerou – Following your comment here, I made this commit to keep things simple for now... but this PR no longer removes side effects, does it? We're back to just fixing crashes when importing the package in Node (though in a much nicer way than in my original PR, thank you very much for your help). Should I remove |
I’m fine with either of these options, up to you! 😊 |
@LeaVerou – I went with option A for now. Thank you! 🙏 |
Oh no @LeaVerou @DmitrySharabin ... I'm so used to the big "Merge" button automatically squashing commits because that's the only setting we allow in my company. I'm so sorry that I spammed |
Actually, we do exactly that for our other projects. It's just slipped through some cracks here. 🙂 |
@benface, I updated the commit history and released a new version. 🥳 |
Yes @DmitrySharabin, v0.1.0 seems to be working very well for me, thank you very much! The only issue that affects my project at this point is #113, but it's minor and not a blocker. I will also be using #45 as soon as it exists, but I simply read the initial values myself for the time being. |
Third time's the charm? (original PRs: #109, #111)