Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can the file system import folders? #1680

Open
Coding-xiaobo opened this issue Dec 25, 2024 · 2 comments
Open

Can the file system import folders? #1680

Coding-xiaobo opened this issue Dec 25, 2024 · 2 comments

Comments

@Coding-xiaobo
Copy link

Could you please tell me how to import a local folder in the file system? For example, I want to import the local node_modules into the jsh terminal through mount. Is it possible? I see that the specific file content is written directly in the files object in the document.

@Coding-xiaobo
Copy link
Author

Coding-xiaobo commented Dec 25, 2024

Just like the files object. Does it support importing folders?

const files = {
  // This is a directory - provide its name as a key
  src: {
    // Because it's a directory, add the "directory" key
    directory: {
      // This is a file - provide its path as a key:
      'main.js': {
        // Because it's a file, add the "file" key
        file: {
          contents: `
            console.log('Hello from WebContainers!')
          `,
        },
      },
      // This is another file inside the same folder
      'main.css': {
        // Because it's a file, add the "file" key
        file: {
          contents: `
            body {
              margin: 0;
            }
          `,
        },
      },
    },
  },
  // This is a file outside the folder
  'package.json': {
    /* Omitted for brevity */
  },
  // This is another file outside the folder
  'index.html': {
    /* Omitted for brevity */
  },
};

@Coding-xiaobo
Copy link
Author

I want to use local node_module, because some dependencies on the packet network environment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant