Version of Eleventy / Eleventy dev server
- @11ty/eleventy 2.0.0-canary.18
- @11ty/eleventy-dev-server 1.0.0-canary.14
Steps to reproduce
- Configure Eleventy to output files in
./dist
- Generate CSS and JS files from
./src/assets/
to ./dist/assets/
output folder using NPM scripts (Sass and esbuild)
- Configure Eleventy Dev Server to pick up changes in output directory using
input
module.exports = function (eleventyConfig) {
// server options
eleventyConfig.setServerOptions({
port: 3000,
input: "./dist",
});
// override base config
return {
dir: {
input: "src",
output: "./dist",
markdownTemplateEngine: "njk",
},
};
};
Configuration seems to be working fine: the port changes to 3000
addWatchTarget does not work either
Tried adding addWatchTarget
for source scss and js files. Not working for me either.
module.exports = function (eleventyConfig) {
// watch targets to trigger a build
eleventyConfig.addWatchTarget("./src/assets/scss/");
eleventyConfig.addWatchTarget("./src/assets/js/");
// server options
eleventyConfig.setServerOptions({
port: 3000,
input: "./dist",
});
// override base config
return {
dir: {
input: "./src",
output: "./dist",
markdownTemplateEngine: "njk",
},
};
};
If I comment out the server config and use eleventy 1.0.2, everythig works as expected, both watch targets trigger a build and a page reload.
Test repository
Here is a repository with a reduced test case if that helps.
Expected behaviour
Eleventy dev server reloads the project when any file changes in ./dist
, be it generated by Eleventy or not.
I am expecting this to be equivalent to browser-sync start --server \"./dist\" --files \"./dist\"
Actual behaviour
HTML files trigger a reload, while CSS and JS files do not.