sandpack
sandpack copied to clipboard
Nodebox: support private package
Bug report
Packages affected
- [ ] sandpack-client
- [X] sandpack-react
Description of the problem
When setting npmRegistries with private registryUrl with template = "vite-react"
or template = "vite-react-ts"
, it failed to load packages.
However, setting template = 'react'
will work.
It seems vite react template will access registryUrl from codeSandbox client instead of user browser, which cause failure to access the registry as it requires vpn
What were you doing when the problem occurred?
What steps can we take to reproduce the problem?
Here's my config
// App.tsx
import React from "react";
import {
Sandpack,
SandpackCodeEditor,
SandpackFileExplorer,
SandpackLayout,
SandpackPreview,
SandpackProvider,
} from "@codesandbox/sandpack-react";
export default () => {
const files = {
"/App.tsx": `
import React from "react";
export default function App() {
return (
<div>
Hello World
</div>
)
};`
};
return (
<div className="app">
<Sandpack
template="vite-react-ts"
files={files}
customSetup={{
npmRegistries: [
{
enabledScopes: ["@my-company"],
limitToScopes: true,
registryUrl: "https://my-company-registry",
},
],
dependencies: {
"@my-company/xxx": "0.0.1",
},
}}
/>
);
};
Your Environment
Software | Name/Version |
---|---|
Sandpack-client version | 2.1.9 |
Sandpack-react version | 2.1.11 |
Browser | chrome |
Operating System | macOS 13.0.1 |
We don't have private npm support in nodebox yet, it's on the roadmap but no planned release date for it yet
For those who are interested in this feature as well, please leave a 👍 on this message, then, we can prioritize it as soon as possible and let everyone know when we launch it.
This seems to happen when "customSteup.environment" is set to "node". Is there a solution before adding features for private NPM support? I think Sandpack is great and easy to use. I don't want to switch to another library.