Giter VIP home page Giter VIP logo

Comments (11)

ije avatar ije commented on May 14, 2024

can you please post the svelte output?

from esm.sh.

mizchi avatar mizchi commented on May 14, 2024

Source

<script>
	import { onMount } from "svelte"
	let name = 'world';
	onMount(() => {
		console.log('mounted');
	})
</script>
<h1>Hello {name}!</h1>

Output

/* App.svelte generated by Svelte v3.31.2 */
import {
	SvelteComponent,
	detach,
	element,
	init,
	insert,
	noop,
	safe_not_equal
} from "svelte/internal";

import { onMount } from "svelte";

function create_fragment(ctx) {
	let h1;

	return {
		c() {
			h1 = element("h1");
			h1.textContent = `Hello ${name}!`;
		},
		m(target, anchor) {
			insert(target, h1, anchor);
		},
		p: noop,
		i: noop,
		o: noop,
		d(detaching) {
			if (detaching) detach(h1);
		}
	};
}

let name = "world";

function instance($$self) {
	onMount(() => {
		console.log("mounted");
	});

	return [];
}

class App extends SvelteComponent {
	constructor(options) {
		super();
		init(this, options, instance, create_fragment, safe_not_equal, {});
	}
}

export default App;

I added rollup plugin to rewrite specifiers like svelte => https://esm.sh/svelte and svelte/internal https://esm.sh/svelte/internal and download it https://github.com/mizchi/uniroll/tree/master/packages/rollup-plugin-http-resolve

you can try here https://svelte.dev/repl/hello-world?version=3.31.2

from esm.sh.

hhun avatar hhun commented on May 14, 2024

@ije
the main store of the library isn't shared between both dependencies.
Is there a way to fix this?

from esm.sh.

ije avatar ije commented on May 14, 2024

currenlty needs to declares the exports in package.json then esm.sh can split the code, for example:

{
  "name": "svelte",
  "exports": {
    "./internal": { "import": "...", "require": "...." }
  }
}

but i think i can add a workaround just for svelte

from esm.sh.

hhun avatar hhun commented on May 14, 2024

@ije
Can you help me write a more specific example?

from esm.sh.

glitch-txs avatar glitch-txs commented on May 14, 2024

@ije we have a library that's modularized into different packages. All packages share the same store, but this communication seems to get lost when importing the different packages with esm.sh

from esm.sh.

1951FDG avatar 1951FDG commented on May 14, 2024

@ije Any update on this?

from esm.sh.

ije avatar ije commented on May 14, 2024

does means "svelte" equals to epxort * from "svelte/internal"

from esm.sh.

ije avatar ije commented on May 14, 2024

i think i have fixed it, but didn't deploy the patch yet
Screenshot 2024-04-23 at 20 32 55

the "svelte" will import "./internal" instaed of bundling it

from esm.sh.

ije avatar ije commented on May 14, 2024

i'm still working on v136, will deploy the change soon

from esm.sh.

1951FDG avatar 1951FDG commented on May 14, 2024

Hi there, will v136 also help/fix #741

from esm.sh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.