Skip to content

syntax error trying to define a Primer wrapper component #21

Open
@jaked

Description

this code

import { ThemeProvider } from "@primer/react";
import { BaseStyles } from "@primer/react";

const Primer = ({ children }) => (
  <ThemeProvider>
    <BaseStyles>{children}</BaseStyles>
  </ThemeProvider>
);

produces the following error

/Users/jaked/repos/react-ts-example/node_modules/.pnpm/@primer+react@36.17.0_@types+react-dom@18.2.25_@types+react@18.2.79_react-dom@18.2.0_react@18_do7p6hwz6bot7ehvwcbcc4xpfy/node_modules/@primer/react/lib-esm/index.js:2
export { default as theme } from './theme.js';
^^^^^^

SyntaxError: Unexpected token 'export'
    at internalCompileFunction (node:internal/vm:77:18)
    at wrapSafe (node:internal/modules/cjs/loader:1288:20)
    at Module._compile (node:internal/modules/cjs/loader:1340:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1023:12)
    at cjsLoader (node:internal/modules/esm/translators:345:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:294:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at ViteRuntime.directRequest (file:///Users/jaked/repos/githubnext/vitale/node_modules/.pnpm/vite@5.2.6_patch_hash=kqh4oqhknnsfnycza4ze24daba/node_modules/vite/dist/node/runtime.js:945:24)
    at ViteRuntime.cachedRequest (file:///Users/jaked/repos/githubnext/vitale/node_modules/.pnpm/vite@5.2.6_patch_hash=kqh4oqhknnsfnycza4ze24daba/node_modules/vite/dist/node/runtime.js:914:76)
    at eval (/Users/jaked/repos/react-ts-example/deps.vnb-cellId=PhZl2Nq7iuZlloauswcKF.tsx:4:31)
    at ESModulesRunner.runViteModule (file:///Users/jaked/repos/githubnext/vitale/node_modules/.pnpm/vite@5.2.6_patch_hash=kqh4oqhknnsfnycza4ze24daba/node_modules/vite/dist/node/runtime.js:1009:5)
    at ViteRuntime.directRequest (file:///Users/jaked/repos/githubnext/vitale/node_modules/.pnpm/vite@5.2.6_patch_hash=kqh4oqhknnsfnycza4ze24daba/node_modules/vite/dist/node/runtime.js:990:60)
    at ViteRuntime.cachedRequest (file:///Users/jaked/repos/githubnext/vitale/node_modules/.pnpm/vite@5.2.6_patch_hash=kqh4oqhknnsfnycza4ze24daba/node_modules/vite/dist/node/runtime.js:914:76)
    at ViteRuntime.executeUrl (file:///Users/jaked/repos/githubnext/vitale/node_modules/.pnpm/vite@5.2.6_patch_hash=kqh4oqhknnsfnycza4ze24daba/node_modules/vite/dist/node/runtime.js:841:12)
    at _VitaleDevServer.executeCell (file:///Users/jaked/repos/githubnext/vitale/packages/server/dist/cli.js:606:35)
    at async Promise.all (index 0)
    at _VitaleDevServer.executeCellsRPC (file:///Users/jaked/repos/githubnext/vitale/packages/server/dist/cli.js:705:22)
    at WebSocket.<anonymous> (file:///Users/jaked/repos/githubnext/vitale/node_modules/.pnpm/birpc@0.2.17/node_modules/birpc/dist/index.mjs:69:20)

I think maybe we're trying to do a server-side import of code that can only be used browser-side.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions