Skip to content

needle-engine/nextjs-sample

Repository files navigation

This is a Next.js Template project bootstrapped with create-next-app adding the needle-engine web component.

Needle Engine

This project is a minimal example of adding needle-engine to a nextjs project

  • needle.config.json
    Added the baseUrl config to ./assets to change codegen (src/generated/gen) to point to the next.js local server relative url
  • next.config.js
    Include the nextjs plugin which handles transpilePackages, webpack defines and licensing
  • tsconfig.json set decorators to true by adding "experimentalDecorators": true
  • src/needleEngine.tsx
    This is a simple next component for including the needle-engine web component. make sure to also add the type declarations from src/declarations.d.ts
  • src/pages/index.tsx
    Import the component to run client-side:
    const NeedleEngine = dynamic(() => import('../needleEngine'), { ssr: false })

FAQ

Learn More

To learn more about Needle Engine & Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.