Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No rebuild or watch work (Win10 - WSL2) #2187

Closed
roroland opened this issue Jan 23, 2022 · 6 comments
Closed

No rebuild or watch work (Win10 - WSL2) #2187

roroland opened this issue Jan 23, 2022 · 6 comments
Labels
bug: --serve restart Changes to projects shouldn’t need to restart dev server bug: windows Issue reported for the Windows environment education feature: 🪞 ignores Ignores, via configuration API or .eleventyignore or .gitignore etc

Comments

@roroland
Copy link

Describe the bug
I make a clean install with 11ty 1.0, No problems during install, I setup the .elevnty.js and run tasks to watch changes with sass. Setup a template, etc
I start Eleventy correctly, but if I make ANY change to md, html or scss it does not rebuild, or watch anything. I have to stop the run task and restart the task again to see my changes.
I've tried every tutorial, tip and post I found on internet... it just not working for me, please be kind :/

To Reproduce
This is my .eleventy.js file

  module.exports = function (eleventyConfig) {

    eleventyConfig.addWatchTarget("./src/sass/");
    eleventyConfig.addPassthroughCopy("./src/css/");
    eleventyConfig.setBrowserSyncConfig({
      files: './_site/css/**/*.css',
    });

    return {
      dir: {
        input: "src",
        output: "_site"
      }
    }
  }

And my package.json

{
"name": "aes",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"watch:sass": "npx sass src/sass:_site/css --watch",
"build:sass": "sass src/sass:_site/css",
"watch:eleventy": "npx @11ty/eleventy --serve",
"build:eleventy": "eleventy",
"start": "npm-run-all build:sass --parallel watch:eleventy",
"build": "npm-run-all build:*"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@11ty/eleventy": "^1.0.0"
},
"dependencies": {
"npm-run-all": "^4.1.5",
"sass": "^1.49.0"
}
}

Expected behavior
It does not rebuild, or watch anything on my project.

Screenshots
Site structure
sitestructure

Environment:

  • OS and Version: Windows 10 / WSL 2
@roroland
Copy link
Author

I was able to watch correctly my sass files changing to node-sass so apparently that part was some wrong configuration.
But I can't make 11ty watch any file change... If I update anything it doesn't copy the file to me _site folder, it doesn't do anything, I have to stop the npm run and start all over @zachleat please help me

I think my project setup couldn't be simpler
currentstate

` module.exports = function (eleventyConfig) {
eleventyConfig.addPassthroughCopy("src/css/");
eleventyConfig.addPassthroughCopy("src/images/");
eleventyConfig.addWatchTarget("src/scss/");
eleventyConfig.setBrowserSyncConfig({
files: './_site/css/**/*.css',
});

return {
  passthroughtFileCopy: true,
  markdownTemplateEngine: "html",
  templateFormats:["html", "njk", "md"],
  dir: {
    input: "src",
    output: "_site",
    include: "includes"
  }
}

}`

PLEASE HELP

@roroland
Copy link
Author

roroland commented Mar 8, 2022

No one ?

@zachleat
Copy link
Member

zachleat commented Mar 8, 2022

Appreciate your patience!

A few folks have commented about this on twitter

https://twitter.com/slecache/status/1481317668141547524
https://twitter.com/jyasskin/status/1331449701430743041
https://twitter.com/roroland/status/1484699570525323266

Folks have had success with using ~ instead

Pro tip: in WSL2, put the files in ~, not /mnt/c. 11ty just got way faster and auto-rebuilds and reloads correctly.

@zachleat zachleat added bug: windows Issue reported for the Windows environment and removed needs-triage labels Mar 8, 2022
@ettmetal
Copy link

ettmetal commented Aug 2, 2022

I, too am having this issue. "Just move files" isn't really a workable solution, I have mine there so that both systems can share files, instead of duplicating. (I do access via a '~' path in WSL using symlinks, so I guess it's not the path that seems to cause the issue)

@zachleat
Copy link
Member

Depending on your .gitignore entries, this might also be a duplicate of #893

@zachleat zachleat added bug: --serve restart Changes to projects shouldn’t need to restart dev server feature: 🪞 ignores Ignores, via configuration API or .eleventyignore or .gitignore etc labels Nov 18, 2022
@zachleat
Copy link
Member

Duplicate of #701.

You can workaround it by moving your project directory under ~ or using the polling feature of chokidar, example here: https://www.11ty.dev/docs/watch-serve/#advanced-chokidar-configuration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: --serve restart Changes to projects shouldn’t need to restart dev server bug: windows Issue reported for the Windows environment education feature: 🪞 ignores Ignores, via configuration API or .eleventyignore or .gitignore etc
Projects
None yet
Development

No branches or pull requests

3 participants