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

Don't bundle the store #2786

Closed
Rich-Harris opened this issue May 16, 2019 · 4 comments
Closed

Don't bundle the store #2786

Rich-Harris opened this issue May 16, 2019 · 4 comments
Labels

Comments

@Rich-Harris
Copy link
Member

#2733 switched the store to TypeScript and started bundling it, which has unintended consequences. It needs to be converted from TS, but should otherwise remain unbundled

@srinivasrk
Copy link

Is there a fix for this ? Should roll up be configured to exclude store?

@Conduitry
Copy link
Member

diff --git a/rollup.config.js b/rollup.config.js
index 0d19e59d4..67b138732 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -94,12 +94,12 @@ export default [
 			{
 				file: `store.mjs`,
 				format: 'esm',
-				paths: id => id.startsWith('svelte/') && id.replace('svelte', '.')
+				paths: () => './internal'
 			},
 			{
 				file: `store.js`,
 				format: 'cjs',
-				paths: id => id.startsWith('svelte/') && id.replace('svelte', '.')
+				paths: () => './internal'
 			}
 		],
 		plugins: [
@@ -113,7 +113,7 @@ export default [
 					transforms: ['typescript']
 				})
 		],
-		external: id => id.startsWith('svelte/')
+		external: () => true
 	},
 
 	// everything else

This seems to do it but gosh is it hacky.

@sanderhahn
Copy link
Contributor

sanderhahn commented May 21, 2019

For the record: another thing i tried is compilation using tsc to produce unbundled versions of the store. However the compilation is slow and the internal path becomes invalid because it is unaware of the rollup path changes:

tsc -m es2015 -d src/store.ts --outDir . && mv store.js store.mjs
tsc -m commonjs src/store.ts --outDir .

@Rich-Harris
Copy link
Member Author

Fixed in #2842

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants