Elderjs / elderjs

Elder.js is an opinionated static site generator and web framework for Svelte built with SEO in mind.
https://elderguide.com/tech/elderjs/
MIT License
2.11k stars 53 forks source link

does not accept updates #218

Closed timeshift92 closed 2 years ago

timeshift92 commented 3 years ago

https://user-images.githubusercontent.com/13614530/139911351-b78fc5f1-0712-41c7-a500-896f3134cd7b.mp4

nickreese commented 3 years ago

Can you add some context?

npx envinfo --system --npmPackages svelte,rollup --binaries --browsers

timeshift92 commented 3 years ago

yes now I will add

timeshift92 commented 3 years ago
 System:
    OS: Windows 10 10.0.19043
    CPU: (12) x64 Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz  
    Memory: 8.60 GB / 31.86 GB
  Binaries:
    Node: 16.2.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.11 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 7.24.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (95.0.1020.40)
    Internet Explorer: 11.0.19041.1202
RockyXRQ commented 3 years ago

I meet this problem too!

delight commented 3 years ago

same here ... just followed the getting started steps + simple text change to Home.svelte results in broken css and no change on the start page.

 System:
    OS: Linux 5.13 KDE neon 5.23
    CPU: (8) x64 Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
    Memory: 2.14 GB / 15.45 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
    Yarn: 1.22.15 - /usr/bin/yarn
    npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
  Browsers:
    Brave Browser: 95.1.31.88
    Chrome: 95.0.4638.69
    Chromium: 95.0.4638.69
    Firefox: 94.0
  npmPackages:
    rollup: ^2.59.0 => 2.59.0 
    svelte: ^3.44.1 => 3.44.1 
nickreese commented 3 years ago

I can't seem to recreate this. Tried a fresh install a couple times and can't seem to hit this issue.

Can you try setting below in your elder.config.js?

    '@elderjs/plugin-browser-reload': {
      // this reloads your browser when nodemon restarts your server.
      port: 8080,
      reload: true, // <---- 
    },
delight commented 3 years ago

Just tried it on a different linux machine. Problem appears even with reload: true ... just tried it with good old npm on node v16.13.

npx degit Elderjs/template elderjs-app
cd elderjs-app
npm i
npm start

After making a change to the first header in Home.svelte, saving it and refreshing the browser the change is not reflected in the browser but instead the css is broken.

There is also this warning even at first start:

(!) Plugin replace: @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.
(!) Plugin rollup-plugin-elder: Layout has unused export property 'settings'. If it is for external reference only, please consider using `export const settings`
src/layouts/Layout.svelte
1: <script>
2:   import style from '../../assets/style.css';
3:   export let templateHtml, settings;
                              ^
4: </script>
5: 
(!) Import of non-existent export
src/layouts/Layout.svelte
1: <script>
2:   import style from '../../assets/style.css';
            ^
3:   export let templateHtml, settings;
4: </script>
created ___ELDER___/compiled in 1.1s
bundles src/components/**/*.svelte → public/_elderjs/svelte...
(!) Plugin replace: @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.
created public/_elderjs/svelte in 810ms

[2021-11-10 20:20:16] waiting for changes...
delight commented 3 years ago

Some more info: The later warning about import style keeps re-appearing on console on saving Home.svelte

bundles src/layouts/*.svelte, src/routes/**/*.svelte, src/components/**/*.svelte → ___ELDER___/compiled...
(!) Plugin replace: @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.
(!) Import of non-existent export
src/layouts/Layout.svelte
1: <script>
2:   import style from '../../assets/style.css';
            ^
3:   export let templateHtml, settings;
4: </script>
created ___ELDER___/compiled in 377ms

[2021-11-10 20:25:14] waiting for changes...
delight commented 3 years ago

Change is reflected after a stop and restart of the server npm start and css is unbroken - up until the next modification to Home.svelte

timeshift92 commented 2 years ago

tell me what can be done, where to look for the problem?

nickreese commented 2 years ago

@timeshift92 Look at the rollupPlugin.ts. There is some overly aggressive caching happening is my guess.

timeshift92 commented 2 years ago

looked but still could not figure out how the rollup buddo does not update the .svelte files, and the websocket also does not transfer changes, new changes are built, but html does not change the values

nickreese commented 2 years ago

My guess is the bug lives somewhere in the code below.

In prior versions of Elder.js we forced the server to restart in all cases and I believe it was covering the bug on windows due to rollup and esbuild's monitoring of the file system.

    writeBundle() {
      if (type === 'ssr') {
        // copy over assets from the ssr folder to the client folder
        const ssrAssets = path.resolve(elderConfig.rootDir, `.${sep}___ELDER___${sep}compiled${sep}assets`);
        const clientAssets = path.resolve(elderConfig.$$internal.distElder, `.${sep}assets${sep}`);
        fs.ensureDirSync(clientAssets);
        const open = fs.readdirSync(ssrAssets);
        if (open.length > 0) {
          open.forEach((name) => {
            fs.copyFileSync(path.join(ssrAssets, name), path.join(clientAssets, name));
          });
        }
      }

      cache.set('dependencies', dependencyCache);

      if (startDevServer && type === 'client') {
        startWatcher();
        startOrRestartServer();
      }
    },
CoryParsnipson commented 2 years ago

Hello! I'm also still running into this issue (in Chrome on Fedora 35).

System:
    OS: Linux 5.12 Fedora Linux 35 (Workstation Edition)
    CPU: (4) x64 Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz
    Memory: 3.16 GB / 7.66 GB
    Container: Yes
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.2 - /usr/bin/node
    Yarn: 1.19.1 - /usr/bin/yarn
    npm: 8.3.0 - /usr/local/bin/npm
    Watchman: 20210704.082152.0 - /usr/local/bin/watchman
  Browsers:
    Chrome: 98.0.4758.80
    Firefox: 96.0.3

I'd also like to add that the caching appears to live through npm run dev restarts. In my project, I have it under version control and if I roll back to the last commit, that somehow changes enough stuff to get the server running again. It breaks again if I modify a route. I get the same error message as @delight and the server does not start.

vvv Thank you! I fiddled around with it for a few minutes and it looks like the issue is resolved for me now.

fergus4 commented 2 years ago

I'm having this same issue. I do not see that it is resolved. I see if I edit a blog page and reload the cxhanges show even on the home page and css is working again....

I've tried on three different Windows 10 machines.