Closed stefl closed 4 years ago
Just testing this a little more, I've copied the src folder into my Next JS app and renamed it ConvertKitForm.
Then, if I import from that folder instead:
import ConvertKitForm from "../components/ConvertKitForm"
Then this compiles fine and I'm able to view the component on the page.
I've also tried compiling your code using
yarn install
yarn run build
And I get a build error:
$ rollup -c
src/index.js → bin/convertkit-form.js...
[!] TypeError: Cannot read property 'preserveSymlinks' of undefined
TypeError: Cannot read property 'preserveSymlinks' of undefined
at Object.buildStart (/Users/stef/apps/unjank/unjank-website/node_modules/convertkit-react/node_modules/@rollup/plugin-node-resolve/dist/cjs/index.js:492:34)
at /usr/local/lib/node_modules/rollup/dist/rollup.js:21537:108
at Array.map (<anonymous>)
at applyBuildStartHook (/usr/local/lib/node_modules/rollup/dist/rollup.js:21537:38)
at Object.rollup (/usr/local/lib/node_modules/rollup/dist/rollup.js:21617:16)
at build (/usr/local/lib/node_modules/rollup/bin/rollup:3397:19)
at /usr/local/lib/node_modules/rollup/bin/rollup:4160:20
at next (/usr/local/lib/node_modules/rollup/bin/rollup:2562:16)
at /usr/local/lib/node_modules/rollup/bin/rollup:2565:53
at process._tickCallback (internal/process/next_tick.js:68:7)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Hope that's helpful. For now I'll work using the directly imported components. Thanks for this!
@stefl thanks for posting all the detailed errors. May I ask which version of convertkit-react
you are getting these errors with? Do you use typescript in your project or have another library that might be relying on it. I've not gotten to test it in TS environments and I hope to add type definitions for TS some day.
Same issue. Using Next.js (latest), "convertkit-react": "^1.4.1", I don't use typescript.
@josephrexme Apologies, I'm only just seeing your reply. I'm not using Typescript, just a standard 'import' statement in my Next.js app. Version 1.4.1, with the package.json specifying "^1.4.1".
No problem @stefl . I will test it on next.js over this weekend and try to address the problem
This is now fixed in version 1.4.2
Hi there,
This looks super handy for me to create a form in my Next.js landing page.
However, following the instructions and importing ConvertkitForm I get the following:
And in VS Code I see the following notice on the line where the import statement is:
However, I can't see you're actually using Typescript, sot that's a little baffling! I'm using a standard Next.js app with a single page and I have other import statements from other libraries working fine, and the rest of the page compiles and renders as normal.
I have this line at the top of my Next.js page component:
And then I'm using the component like this in the page:
(XYZ are numbers in the actual code).
Hope you can help because this looks perfect for my needs.
Cheers!