using private NPM packages #401
Answered
by
danilowoz
gracegotlost
asked this question in
Q&A
-
I know this has been asked once in the preview discussion here. I tried the suggestion but got an error, I have my code below:
and below is the error
I'm not sure what path should be inside the index file here: Any suggestions are very much appreciated!! |
Beta Was this translation helpful? Give feedback.
Answered by
danilowoz
Mar 9, 2022
Replies: 1 comment
-
Hey, actually there is something wrong in your implementation: export default function App() {
return (
<Sandpack
template="react"
files={{
"/App.js": `import { A } from "@company/design-system";
export default function App() {
return (<A />)
}`,
// Dependencies
"/node_modules/@company/design-system/package.json": JSON.stringify({
name: "@company/design-system",
main: "lib/index.js"
}),
"/node_modules/@company/design-system/lib/index.js": `
// Importing a third file
export { A } from "@company/design-system/src/A"
`,
// Missing file
"/node_modules/@company/design-system/src/A.js": `
export const A = () => "A";
`
}}
/>
);
} Hope it makes clear how dependencies work. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
danilowoz
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, actually there is something wrong in your implementation: