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

Problem serving MIME type="module" #1458

Closed
AmyScript opened this issue Jan 11, 2019 · 4 comments
Closed

Problem serving MIME type="module" #1458

AmyScript opened this issue Jan 11, 2019 · 4 comments
Labels
🎒 Bundler Refers to CodeSandbox's In-Browser Bundler 🤔 Improvement Needs More Info

Comments

@AmyScript
Copy link

🐛 bug report

Trying to add web components through:

<script type="module">
      import "./node_modules/@amyscript/dsg-info-card/dsg-info-card.js";
 </script>

getting this error:
screen shot 2019-01-11 at 10 54 47 am

How has this issue affected you? What are you trying to accomplish?

can't import the web component module via code sandbox even though it works perfectly on a local server

Link to sandbox: link

Your Environment

| Software | Name/Version|
| Сodesandbox | Current
| Browser | Chrome
| Operating System | Mac

@SaraVieira
Copy link
Contributor

Can you try this on the static template ?

https://codesandbox.io/s/github/codesandbox-app/static-template

@looeee
Copy link

looeee commented Feb 11, 2019

I made a simple <script type=module > test, with the static template in browser modules are working fine. But I'm still getting the"failed to load script error" with node modules.

https://codesandbox.io/s/4xxmx6opl4

@lbogdan lbogdan added 🤔 Improvement 🎒 Bundler Refers to CodeSandbox's In-Browser Bundler labels Mar 22, 2019
@lbogdan
Copy link
Contributor

lbogdan commented Mar 22, 2019

@AmyScript Can you please provide another link, as the sandbox you pointed to doesn't exist anymore?

I made a simple <script type="module"> test, with the static template in browser modules are working fine.
But I'm still getting the"failed to load script error" with node modules.

@looeee That's because the static template doesn't support using npm packages.

@CompuIves
Copy link
Member

We could potentially add support for node_modules in static template, but this would require some server side changes. I think the best way to currently handle this is by creating a sandbox based on a container, like https://codesandbox.io/s/node. These sandboxes are run on a server and correctly host the node_modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎒 Bundler Refers to CodeSandbox's In-Browser Bundler 🤔 Improvement Needs More Info
Projects
None yet
Development

No branches or pull requests

5 participants