Skip to content

React component can't be easily consumed in Next.js #165

@weyert

Description

@weyert

If you try to use the React components in Next.js you can't easily use them due to the way it's bundled at the moment, it now it requires to be transpilled before:

export * from './context';
^^^^^^

SyntaxError: Unexpected token 'export'
    at wrapSafe (internal/modules/cjs/loader.js:1117:16)
    at Module._compile (internal/modules/cjs/loader.js:1165:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1221:10)
    at Module.load (internal/modules/cjs/loader.js:1050:32)
    at Function.Module._load (internal/modules/cjs/loader.js:938:14)
    at Module.require (internal/modules/cjs/loader.js:1090:19)
    at require (internal/modules/cjs/helpers.js:75:18)
    at eval (webpack-internal:///posthog-js/react:1:18)
    at Object.posthog-js/react (/Users/weyertdeboer/Development/Projects/demo/build/server/pages/_app.js:331:1)

I think it would be convenient if we don't need to transpile. The tsconfig.json suggests it should output es5 but it isn't.

Metadata

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