FredKSchott / create-snowpack-app

The all-in-one app template for Snowpack. [moved]
https://www.snowpack.dev
Other
727 stars 96 forks source link

[@snowpack/app-template-11ty] - HMR issue eleventy templates #180

Open Lukjuh opened 4 years ago

Lukjuh commented 4 years ago

Hi there,

I don't know if this is a specific platform problem, but I have the following problem with the HRM.

I use the @snowpack/app-template-11ty and it works fine except that HRM is not working for the about.md the page gets refreshed and even in the _ouput folder the about/index.html updates with the given change. Only i don't see the change on the page it self. Only if i run npm start again is see the changes.

Added h1 image

image

image

Not seeing the change in the browser image

Sometimes i get this error:

File changed: _template\about.md
  Writing _output/about/index.html from ./_template/about.md.
  Writing _output/index.html from ./_template/index.njk.
  Copied 4 items / Wrote 2 files in 0.05 seconds (v0.10.0)
  Watching…
  File changed: _template\about.md
  Error with passthrough copy: (more in DEBUG output)
  > Having trouble copying './_template/static/index.css'

  `TemplatePassthroughManagerCopyError` was thrown
  > EPERM: operation not permitted, open 'C:\Users\Luukl\Documents\new-dir\_output\static\index.css'

  `Error` was thrown:
  Unhandled rejection in promise ([object Promise]): (more in DEBUG output)   
  > Having trouble copying

  `TemplateWriterWriteError` was thrown
  > Having trouble copying './_template/static/index.css'

  `TemplatePassthroughManagerCopyError` was thrown
  > EPERM: operation not permitted, open 'C:\Users\Luukl\Documents\new-dir\_output\static\index.css'

  `Error` was thrown:
  Error writing templates: (more in DEBUG output)
      Error: EPERM: operation not permitted, open 'C:\Users\Luukl\Documents\new-dir\_output\static\index.css'
      Error: EPERM: operation not permitted, open 'C:\Users\Luukl\Documents\new-dir\_output\static\index.css'
      Error: EPERM: operation not permitted, open 'C:\Users\Luukl\Documents\new-dir\_output\static\index.css'
      Error: EPERM: operation not permitted, open 'C:\Users\Luukl\Documents\new-dir\_output\static\index.css'
  Copied 2 items / Wrote 0 files in 0.04 seconds (v0.10.0)
  Writing _output/about/index.html from ./_template/about.md.
  Writing _output/index.html from ./_template/index.njk.

  Watching…
  > Having trouble copying

  `TemplateWriterWriteError` was thrown
  > Having trouble copying './_template/static/index.css'

  `TemplatePassthroughManagerCopyError` was thrown
  > EPERM: operation not permitted, open 'C:\Users\Luukl\Documents\new-dir\_output\static\index.css'

  `Error` was thrown:
  Problem writing Eleventy templates: (more in DEBUG output)
  > Having trouble copying

  `TemplateWriterWriteError` was thrown
  > Having trouble copying './_template/static/index.css'

  `TemplatePassthroughManagerCopyError` was thrown
  > EPERM: operation not permitted, open 'C:\Users\Luukl\Documents\new-dir\_output\static\index.css'

  `Error` was thrown:
  A promise rejection was handled asynchronously: (more in DEBUG output)      
  > (No error message provided)

  `undefined` was thrown

My setup: Windows: 10 npm: 6.12.1 node: v12.13.1

On my linux machine everything is working fine.

drwpow commented 4 years ago

Hm @Lukjuh thanks for all the info! I admit I’m testing this on a Mac, not a Windows, but we are using this on a few of our own websites and the HMR seems to work fine. I’m not 100% sure, but based on those error messages those seem to be coming from 11ty, not Snowpack. Have you been able to use 11ty successfully outside of Snowpack?