') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); [SDK-815] Import of deprecated from @clerkjs/shared breaks Vite builds using @clerkjs/clerk-sdk-node · Issue #1883 · clerk/javascript · GitHub
Skip to content

[SDK-815] Import of deprecated from @clerkjs/shared breaks Vite builds using @clerkjs/clerk-sdk-node #1883

Description

@markjaquith

Preliminary Checks

Reproduction / Replay Link

https://github.com/markjaquith/clerk-sdk-node-4-12-13-bug

Publishable key

pk_test_Y2xvc2luZy1seW54LTkzLmNsZXJrLmFjY291bnRzLmRldiQ

Description

@clerk/clerk-sdk-node v4.12.13 introduced an import from @clerk/shared to handle deprecation notices.

This import breaks Vite builds, because of some CommonJS import nonsense.

With v4.12.12, Vite builds clean.

With v4.12.13 when running npm run build, I get:

file:///Users/mark/Sites/clerk-sdk-bug/node_modules/@clerk/clerk-sdk-node/dist/esm/chunk-IBBCRHOG.mjs:31
import { deprecated } from "@clerk/shared";
^^^^^^^^^^
SyntaxError: Named export 'deprecated' not found. The requested module '@clerk/shared' is a CommonJS module, which may not support all module.exports as named exports.

The fact that I'm using SvelteKit here isn't material. None of the functionality matters, just that Vite is now (in a patch update) choking on @clerk/shared apparently being a CommonJS module.

Reproduction

  1. Clone the above repo.
  2. npm i
  3. npm run build (see error)
  4. npm i @clerk/clerk-sdk-node@4.12.12 (revert to earlier version)
  5. npm run build (no error)

Environment

System:
OS: macOS 14.0
CPU: (10) arm64 Apple M1 Max
Memory: 7.70 GB / 64.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.17.1 - ~/.nvm/versions/node/v18.17.1/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 9.6.7 - ~/.nvm/versions/node/v18.17.1/bin/npm
pnpm: 7.21.0 - /opt/homebrew/bin/pnpm
npmPackages:
@clerk/clerk-js: ^4.61.0 => 4.61.0 @clerk/clerk-sdk-node: ^4.12.13 => 4.12.13 @clerk/types: ^3.55.0 => 3.55.0 @sveltejs/adapter-auto: ^2.1.0 => 2.1.0 @sveltejs/kit: ^1.5.0 => 1.25.2 @typescript-eslint/eslint-plugin: ^5.45.0 => 5.62.0 @typescript-eslint/parser: ^5.45.0 => 5.62.0 autoprefixer: ^10.4.14 => 10.4.16 dotenv: ^16.3.1 => 16.3.1 eslint: ^8.28.0 => 8.51.0 eslint-config-prettier: ^8.5.0 => 8.10.0 eslint-plugin-svelte: ^2.26.0 => 2.34.0 postcss: ^8.4.23 => 8.4.31 prettier: ^2.8.0 => 2.8.8 prettier-plugin-svelte: ^2.8.1 => 2.10.1 react: ^18.2.0 => 18.2.0 svelte: ^3.54.0 => 3.59.2 svelte-check: ^3.0.1 => 3.5.2 tailwindcss: ^3.3.2 => 3.3.3 tslib: ^2.4.1 => 2.6.2 typescript: ^5.2.2 => 5.2.2 vite: ^4.4.11 => 4.4.11

SDK-815

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinglinearCreated by Linear-GitHub Sync

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions