svelte-infinitegrid not working on Svelte@3.19.1
See original GitHub issueDescription
Tried all ways to get it to work. Seems to only work on Codesandbox when tried there, also with a new Svelte development on Codesandbox platform it works but not on local development. Tried to download the zip from Codesandbox and run locally but same error produced. Debuged and found potential issues of environment setup includes packages that might be ommited/differ from local development.
// error output on browser console
Uncaught ReferenceError: svelteInfinitegrid is not defined
package.json file
{
"name": "svelte-app",
"version": "1.0.0",
"scripts": {
"build": "rollup -c",
"dev": "rollup -c -w",
"start": "sirv public"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^11.0.2",
"@rollup/plugin-node-resolve": "^7.1.1",
"rollup": "^1.32.0",
"rollup-plugin-livereload": "^1.0.4",
"rollup-plugin-node-builtins": "^2.1.2",
"rollup-plugin-node-globals": "^1.4.0",
"rollup-plugin-svelte": "^5.1.1",
"rollup-plugin-terser": "^5.2.0",
"svelte": "^3.19.1"
},
"dependencies": {
"@egjs/svelte-infinitegrid": "^3.0.2",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"sirv-cli": "^0.4.5"
}
}
rollup.config.js
import svelte from "rollup-plugin-svelte";
import globals from "rollup-plugin-node-globals";
import builtins from "rollup-plugin-node-builtins";
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";
const production = !process.env.ROLLUP_WATCH;
export default {
input: "src/main.js",
external: ["@egjs/svelte-infinitegrid"],
output: {
globals: {
"@egjs/svelte-infinitegrid" : "svelteInfinitegrid"
},
sourcemap: true,
format: "iife",
name: "app",
file: "public/build/bundle.js"
},
plugins: [
svelte({
// 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: css => {
css.write("public/build/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(),
globals(),
builtins(),
// 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()
],
watch: {
clearScreen: false
}
};
function serve() {
let started = false;
return {
writeBundle() {
if (!started) {
started = true;
require("child_process").spawn("npm", ["run", "start", "--", "--dev"], {
stdio: ["ignore", "inherit", "inherit"],
shell: true
});
}
}
};
}
Steps to check or reproduce
$ npm run dev
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Svelte Infinite Scroll Pagination API • REPL • Svelte
import InfiniteScroll from "./InfiniteScroll.svelte";. 4. 5. // if the api (like in this example) just have a simple numeric pagination.
Read more >An infinite scroll component for Svelte apps : r/sveltejs - Reddit
Recently, I tried to implement an infinite scroll in my web app. Unfortunately my implementation had lots of bugs and didn't work very...
Read more >@egjs/svelte-infinitegrid - npm
A Svelte component that can arrange items infinitely according to the type of grids. Latest version: 4.7.1, last published: 3 months ago.
Read more >Can not bind:this on Grid.js in svelte - Stack Overflow
When trying to do ( grid is defined) i can see the $$ , $destroy , $on and $set properties but for any...
Read more >How to create Infinite Scroll with Svelte - DEV Community
For this example we will use the Intersection Observer API Component in... Tagged with svelte, javascript, frontend, nelsoncode.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@hengnee
Oh sorry. There was a typo in package.json. Updated to
svelte-infinitegrid
3.0.3. Check it again.Thank you! It works now.