Skip to content

build directory not self-sufficient anymore? #4285

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

Closed
christophemacabiau opened this issue Mar 10, 2022 · 2 comments
Closed

build directory not self-sufficient anymore? #4285

christophemacabiau opened this issue Mar 10, 2022 · 2 comments

Comments

@christophemacabiau
Copy link

Describe the bug

I am not sure but it seems that there is a bundling problem in the latest version of svelte-kit.

Reproduction

https://stackblitz.com/edit/sveltejs-kit-template-default-tvp61o

Create a typescript skeleton project:

npm init svelte@next my-app
cd my-app
npm install
npm i -D svelte-i18n @sveltejs/adapter-node@next 

use adapter-node in svelte.config.js:

import adapter from '@sveltejs/adapter-node';
import preprocess from 'svelte-preprocess';

/** @type {import('@sveltejs/kit').Config} */
const config = {
	// Consult https://github.com/sveltejs/svelte-preprocess
	// for more information about preprocessors
	preprocess: preprocess(),

	kit: {
		adapter: adapter()
	}
};

export default config;

and build the project npm run build

The generated file build/server/entries/pages/index.svelte.js is:

import { c as create_ssr_component } from "../../chunks/index-2dc61825.js";
const Routes = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  return `<h1>Welcome to SvelteKit</h1>
<p>Visit <a href="${"https://kit.svelte.dev"}">kit.svelte.dev</a> to read the documentation</p>`;
});
export { Routes as default };

Now import svelte-i18n in src/routes/index.svelte

<script lang="ts">
  import 'svelte-i18n';
</script>

<h1>Welcome to SvelteKit</h1>
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>

rebuild, the generated file build/server/entries/pages/index.svelte.js is now:

import { n as noop, a as safe_not_equal, b as subscribe, r as run_all, i as is_function, c as create_ssr_component } from "../../chunks/index-110612cb.js";
import { __assign, __extends, __spreadArray } from "tslib";
...

The build directory now needs node_modules with all necessary imports.

Logs

No response

System Info

System:
    OS: Linux 5.11 Ubuntu 21.04 (Hirsute Hippo)
    CPU: (16) x64 AMD Ryzen 7 4800H with Radeon Graphics
    Memory: 25.32 GB / 30.78 GB
    Container: Yes
    Shell: 3.1.2 - /usr/bin/fish
  Binaries:
    Node: 17.6.0 - /usr/bin/node
    npm: 8.5.1 - /usr/bin/npm
  Browsers:
    Chrome: 99.0.4844.51
    Firefox: 96.0
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.31 
    @sveltejs/adapter-node: ^1.0.0-next.71 => 1.0.0-next.71 
    @sveltejs/kit: next => 1.0.0-next.295 
    svelte: ^3.44.0 => 3.46.4

Severity

blocking an upgrade

Additional Information

related to #4271

@Conduitry
Copy link
Member

Is this a duplicate of #3176? It sounds like it might be.

@christophemacabiau
Copy link
Author

yes!
thank you a lot!
and thank you for the workaround :-)

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