sandpack icon indicating copy to clipboard operation
sandpack copied to clipboard

Nodebox: support private package

Open HUANGXUANKUN opened this issue 1 year ago • 3 comments

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

HUANGXUANKUN avatar Mar 22 '23 15:03 HUANGXUANKUN

We don't have private npm support in nodebox yet, it's on the roadmap but no planned release date for it yet

DeMoorJasper avatar Apr 03 '23 13:04 DeMoorJasper

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.

danilowoz avatar Apr 04 '23 17:04 danilowoz

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.

Versirity avatar Dec 28 '23 02:12 Versirity