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

Changing default environment #40

Closed
pomber opened this issue Apr 12, 2021 · 6 comments · Fixed by codesandbox/codesandbox-client#5691
Closed

Changing default environment #40

pomber opened this issue Apr 12, 2021 · 6 comments · Fixed by codesandbox/codesandbox-client#5691
Labels
bug Something isn't working

Comments

@pomber
Copy link

pomber commented Apr 12, 2021

I'm trying to load in sandpack the same files as in this csb: https://codesandbox.io/s/test-parcel-environment-b7uf3

This is what I'm trying: https://codesandbox.io/s/sandpack-test-parcel-environment-7yjt2?file=/src/App.js

But apparently it's using the create-react-app environment even when I'm passing environment: 'parcel'.

Am I missing something or is it a bug?

@alexnm alexnm added the bug Something isn't working label Apr 14, 2021
@pomber
Copy link
Author

pomber commented Apr 18, 2021

Well, it's using create-react-app even when I use the vanilla template:

export default function App() {
  return <SandpackRunner template="vanilla" />;
}

When I click the "Open in CodeSandbox" button, it shows:

Not sure if that's intentional.

@alexnm
Copy link
Collaborator

alexnm commented Apr 19, 2021

this is codesandbox determining the environment based on the input files. for generating the sandbox via the link we only pass the files, no meta information about environment. but I'm looking into the parcel/vanilla setup to see why your first example doesn't work

@pomber
Copy link
Author

pomber commented Apr 19, 2021

Not sure if it is related to the environment, but when I try a sandpack that is just an HTML loading an external script, the script doesn't load. I tried several things and couldn't make it work.

@alexnm
Copy link
Collaborator

alexnm commented Apr 20, 2021

this is a limitation of the current bundler, I'll make a new issues tomorrow explaining the exact situation. currently we cannot execute code that is passed in the head tag of the entry html file

@pomber
Copy link
Author

pomber commented Apr 20, 2021

this is a limitation of the current bundler, I'll make a new issues tomorrow explaining the exact situation. currently we cannot execute code that is passed in the head tag of the entry html file

Same happens if I move the script from the head to the body. Any workaround to load an external script from the HTML?

@alexnm
Copy link
Collaborator

alexnm commented Apr 20, 2021

We probably need to change the implementation in the bundler, the body is replaced with the body of the HTML page, but scripts are not executed this way.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants