Giter VIP home page Giter VIP logo

Comments (6)

scarf005 avatar scarf005 commented on June 10, 2024 1

this can be workaround using watch or hmr.

  1. run echo 'import "lume/cli.ts"' > _main.ts on terminal.
  2. change tasks in deno.json to following:
 	"tasks": {
-		"lume": "echo \"import 'lume/cli.ts'\" | deno run -A -",
-		"build": "deno task lume",
-		"serve": "deno task lume -s"
+		"build": "deno run -A _main.ts",
+		"serve": "deno run -A --unstable-hmr _main.ts -s"
 	},

it should work like following:

$ deno task serve
Task serve deno run -A --unstable-hmr _main.ts -s
HMR Process started.
Loading config file file:///home/scarf/repo/etc/esbuild-issue/_config.ts
🔥 /main.js <- /main.tsx
🍾 Site built into ./_site
  1 files generated in 0.01 seconds
  Server started at:
  http://localhost:3000/ (local)
  http://192.168.1.90:3000/ (network)
Changes detected:
- /_config.ts
HMR Replaced changed module file:///home/scarf/repo/etc/esbuild-issue/_config.ts

from lume.

oscarotero avatar oscarotero commented on June 10, 2024

Hi.
Can I see the code of how you're using the component?

In Lume, components are loaded automatically in the comp variable. Example:

export default function ({ comp}: Lume.Data ) {
  return <p><comp.Button /></p>
}

from lume.

iacore avatar iacore commented on June 10, 2024

In Lume, components are loaded automatically in the comp variable. Example:

I use import Component from '../Component.tsx'.

I use a lot of functions between files too.

import { generate } from "./all.atom.xml.tsx"

from lume.

oscarotero avatar oscarotero commented on June 10, 2024

The problem is Deno caches the imported modules and there's no way to invalidate the cache to refresh the modules.

In Lume, this limitation is solved loading the file with a hash (for example, import foo from "./foo.ts#hash123"). Components are loaded in this way so if a file changes, Lume reload the file with a different hash.

Deno added recently a way to do hot module replacement (https://deno.com/blog/v1.38#hot-module-replacement) but it's still unstable and doesn't work well with Lume.

from lume.

iacore avatar iacore commented on June 10, 2024

Related: denoland/deno#8327

from lume.

iacore avatar iacore commented on June 10, 2024

this can be workaround using watch or hmr.

1. run `echo 'import "lume/cli.ts"' > _main.ts` on terminal.

2. change tasks in `deno.json` to following:

I totally missed this... now my site is mostly stable I don't have a easy way to test this. Hopefully someone else will find this useful.

from lume.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.