Include svelte internals in rollup?
mhkeller opened this issue · 1 comments
mhkeller commented
I'm trying to compile a svelte file but the resulting rolled-up code depends on svelte/internal/client to run. Is something wrong with my rollup config (it's pretty basic and I'm not deliberately marking anything as an external dependency) or is this the expected behavior? Here's my svelte component and the compiled output: https://gist.github.com/mhkeller/47ea2709ce32c1c0004ff9864f439246
edit: here's my rollup config
const { rollup } = require('rollup');
const svelte = require('rollup-plugin-svelte');
const { nodeResolve } = require('@rollup/plugin-node-resolve');
const commonjs = require('@rollup/plugin-commonjs');
const outputOptions = {
format: 'iife'
};
const plugins = [
svelte({
emitCss: false
}),
nodeResolve({
browser: true,
exportConditions: ['svelte'],
extensions: ['.svelte']
}),
commonjs(),
];
const inputOptions = {
input: 'path/to/file.svelte',
plugins
};
const bundle = await rollup(inputOptions);
const generated = await bundle.generate(outputOptions)mhkeller commented
The issue was that svelte didn't exist in the directory where File.svelte existed. The solution is to either install it there or use modulePaths to point to it.