Closed jeromecc closed 2 years ago
What does your rollup config look like? You'll likely want to have the svelte plugin before the others like in the example:
https://github.com/jacobmischka/svelte-flatpickr/blob/master/test/rollup.config.js#L44-L80
Here is my rollup.config.js
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import livereload from 'rollup-plugin-livereload';
import { terser } from 'rollup-plugin-terser';
import copy from 'rollup-plugin-copy';
import json from '@rollup/plugin-json';
import css from 'rollup-plugin-css-only';
const production = !process.env.ROLLUP_WATCH;
function serve() {
let server;
function toExit() {
if (server) server.kill(0);
}
return {
writeBundle() {
if (server) return;
server = require('child_process').spawn('npm', ['run', 'start', '--', '--dev'], {
stdio: ['ignore', 'inherit', 'inherit'],
shell: true
});
process.on('SIGTERM', toExit);
process.on('exit', toExit);
}
};
}
export default {
input: 'src/main.js',
output: {
sourcemap: true,
format: 'iife',
name: 'app',
file: 'public/build/bundle.js'
},
plugins: [
svelte({
// enable run-time checks when not in production
include: 'src/**/*.svelte',
//preprocess: autoPreprocess(),
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
}),
json(),
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']
}),
commonjs(),
//postcss(postcssOptions()),
// In dev mode, call `npm run start` once
// the bundle has been generated
!production && serve(),
// Watch the `public` directory and refresh the
// browser on changes when not in production
!production && livereload('public'),
// If we're building for production (npm run build
// instead of npm run dev), minify
production && terser(),
copy({
targets: [
{
src: 'public/*',
dest: '../../static/conversation/scroll/'
}
]
}),
copy({
targets: [
// {
// src: 'node_modules/bootstrap/dist/**/*',
// dest: 'public/vendor/bootstrap'
//},
{
src: 'node_modules/flatpickr/dist/themes/light.css',
dest: 'public/vendor/flatpickr/'
},
{
src: 'node_modules/flatpickr/dist/flatpickr.css',
dest: 'public/vendor/flatpickr/'
},
]
}),
],
watch: {
clearScreen: false
}
};
Ah yeah, remove that include
entry from your svelte plugin config. You want it to compile dependencies if they exist, most svelte components publish like this one to intentionally have you bundle it yourself.
Thanks for your time. Problem solved. :))
Hello! I'm getting this error with Node v16.14.0. Any idea where it could come from? Thanks!
Here is my package.json:
Despite this error message, my Datepickr component seems to be working fine...