Replies: 4 comments 1 reply
-
Yes, you could just call |
Beta Was this translation helpful? Give feedback.
-
HI Jovi, can u give me a super quick GIST so i can build on top? |
Beta Was this translation helpful? Give feedback.
-
Mind clarifying, as this doesn't really make sense? A source map is used to map built output (minified) back to the source code, it's entirely for debugging & reporting purposes. You can't ship code via source maps. And then it depends a bit on how you're planning to use your external, non-built code. If you're creating separate trees, as Jovi suggests, you can use function MyComponent() {
return <h1>Hello World!</h1>;
}
render(<MyComponent />, document.getElementById('my-component-entry')); So If you're instead trying to use external libs in your Preact app, import maps & setting <!DOCTYPE html>
<html>
<head>
<script type="importmap">
{
"imports": {
"my-lib": "https://esm.sh/my-lib@1.2.3"
}
}
</script>
</head>
<body>
<div id="app"></div>
</body>
</html> With Vite, you'd set something like this I believe: import { defineConfig } from 'vite'
export default defineConfig({
build: {
rollupOptions: {
external: ['my-lib'],
},
},
}); Which will tell Vite, when building your app, that |
Beta Was this translation helpful? Give feedback.
-
thanks for this super valuable info. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
HI Guy, weve been playing tons with preact here and moving some of our stack to it.
Question: (this is not preact per se) is there a way to use part of the app bundled where the rest comes from source maps.... for example id like to already bundle all my comps with vite but use them while rest of the app is imported from the outside.
Any help appreciated.
Beta Was this translation helpful? Give feedback.
All reactions