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

React usage in codesandbox #1

Open
jimthedev opened this issue Sep 6, 2018 · 7 comments
Open

React usage in codesandbox #1

jimthedev opened this issue Sep 6, 2018 · 7 comments

Comments

@jimthedev
Copy link

Hi there. Thanks for creating this. I was wondering if you've seen this. I created a code sandbox here and in index.js there are these lines:

import { defineCustomElements as defineCustomElementsUsingImport } from "split-me";
const {
  defineCustomElements: defineCustomElementsUsingRequire
} = require("split-me");

Sadly it doesn't seem to work as the objects being imported seem to be undefined. What is strange is that locally I created an app and it seems to work ok. Not sure what is going on. If I added in a line to index.html to add a script tag from unpkg then it works just fine.

Just curious if there is something else that might be going on that I am unaware of.

Cheers.

@alesgenova
Copy link
Owner

Hi Jim!

I checked out the sandbox and everything seems in order from the code point of view.

Might it be an issue with code sandbox itself?
It's showing that the only export of the split-me package is an empty object as default.
I think it's not honoring the "module": "dist/esm/index.js" entry in package.json

Sorry I couldn't be more helpful, let me know if you find a solution

@jimthedev
Copy link
Author

Hey there! So I thought so and tried it on stackblitz.io with the same result. So strange.

@alesgenova
Copy link
Owner

Btw, the same thing (unsurprisingly) happens when using the latest @ionic/core, which is a collection of stencil components

@jimthedev
Copy link
Author

hmmmm

@jimthedev
Copy link
Author

It must be something with either how stencil is packaging or how codesandbox is consuming those packages.

This fails to run in codesandbox but downloading the project and running locally works just fine.

@jimthedev
Copy link
Author

jimthedev commented Sep 7, 2018

Ok I opened dual issues: one with Codesandbox and one with Stencil:

I found a workaround that is in these issues but I don't understand why it is needed and would prefer to get at the root of the problem.

@alesgenova
Copy link
Owner

Interesting discussion, especially in the codesandbox issue. Let's see what the stencil devs say.

Thanks for the update!

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

2 participants