-
Notifications
You must be signed in to change notification settings - Fork 24
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
Since update to 3.3.4 my own app does not build correctly anymore and Flatpickr is inserted as argument to my app #71
Comments
I don't think Flatpickr should be an external module, you likely want it to import and bundle it. Can you post your rollup config? |
Essentially, I think your https://github.com/sveltejs/rollup-plugin-svelte config isn't quite right. Before by default you were getting the compiled javascript, but you really want to be importing the uncompiled svelte and compiling it yourself along with the rest of your svelte app. I think you're missing something like this: resolve({
browser: true,
exportConditions: ['svelte'],
extensions: ['.svelte']
}) Please change your rollup config to closely mirror the example config in that README and try again. |
import svelte from 'rollup-plugin-svelte';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import livereload from 'rollup-plugin-livereload';
import terser from '@rollup/plugin-terser'
import css from 'rollup-plugin-css-only';
import dev from 'rollup-plugin-dev';
import sveltePreProcess from "svelte-preprocess";
import typescript from "@rollup/plugin-typescript";
import {babel} from '@rollup/plugin-babel';
import replace from '@rollup/plugin-replace';
const production = !process.env.ROLLUP_WATCH;
export default {
input: ['src/main.js'],
output: {
sourcemap: true,
format: 'iife',
name: 'app',
file: '../resources/assets/svelte/build/bundle.js'
},
plugins: [
svelte({
preprocess: sveltePreProcess({
sourceMap: !production
}),
emitCss: true,
compilerOptions: {
// enable run-time checks when not in production
dev: !production,
// we'll extract any component CSS out into
// a separate file — better for performance
css: 'external',
cssOutputFilename: '../resources/assets/svelte/build/bundle.css',
},
onwarn: (warning, handler) => {
const { code, frame } = warning;
if (code === "css-unused-selector")
return;
handler(warning);
},
}),
typescript({
sourceMap: !production,
inlineSources: !production,
compilerOptions: {
types: ['node'],
}
}),
// we'll extract any component CSS out into
// a separate file - better for performance
css({output: 'bundle.css'}),
// If you have external dependencies installed from
// npm, you'll most likely need these plugins. In
// some cases you'll need additional configuration -
// consult the documentation for details:
// https://github.com/rollup/plugins/tree/master/packages/commonjs
resolve({
browser: true,
dedupe: ['svelte'],
//extensions: ['.svelte'],
//exportConditions: ['svelte']
}),
// set prevent assignment manually because as the next major version
// will default this option to true
replace({
'process.env.NODE_ENV': JSON.stringify('production'),
preventAssignment: false,
}),
// OR development config
replace({
'process.env.NODE_ENV': JSON.stringify('development'),
preventAssignment: false,
}),
commonjs(),
production && babel({
babelHelpers: 'runtime',
extensions: [".js", ".mjs", ".html", ".svelte", ".ts"],
exclude: ["node_modules/@babel/**"],
presets: [
[
"@babel/preset-env",
{
targets: "> 0.25%, not dead",
},
],
],
plugins: [
"@babel/plugin-syntax-dynamic-import",
[
"@babel/plugin-transform-runtime",
{
useESModules: true,
},
],
],
}),
// Watch the `public` directory and refresh the
// browser on changes when not in production
!production && livereload('../resources'),
// If we're building for production (npm run build
// instead of npm run dev), minify
production && terser()
],
watch: {
clearScreen: false
}
}; I tried adding the extensions as you suggested, but that didn't work. Instead, I am getting an additional error that 3 dependecies are unresolved PLUS the same dependencies still as missing global variable names as before. |
You definitely want the You might be able to change your import to |
Thanks for your answer, I was in holidays and I just had a look at this now again. |
Hi all,
I have a weird issue and it took me some time to figure out, that this comes from the update from version
<=3.3.2
to version3.3.4
.My bundle.js is created with rollup. Everything worked perfectly fine and my bundle.js looked somewhat like this:
However, I now want to update to Svelte v4 and therefore updated to version
3.3.4
, because you provide support for Svelte there. The problem that I than have is that my bundle.js is still built, but the Flatpickr kind of wrapps around my app/is inserted as argument to my app function:This results in my app not working anymore (I will only see a white screen) and a hint showing up:
Maybe someone of you has an idea, what exactly causes the issue (it must be something in the commits for version 3.3.4) and how to solve it, such that I can still build my app also with Svelte v4?
Cheers,
Jonas
The text was updated successfully, but these errors were encountered: