snowpack mounts before scripts run
amithm7 opened this issue · 5 comments
I see this as first line of log:
[snowpack] config.mount[/.../src/_site]: mounted directory does not exist
But this repo somehow builds eleventy before snowpack builds. (npx snowpack build
)
I use the same snowpack config but unable to have src/_site
files copied over, before snowpack builds. How is this working?
👋 @amithm7, this is sadly an error which was inttroduced in Snowpack after version 3.0.13
.
I already filed a bug report: FredKSchott/snowpack#2936.
I had hopes that this is something which is getting solved quickly, but as you can see it is open for a bit now.
At the moment I'm thinking of switching Snowpack with Vite and see how this is going.
Hi @stefanfrede , thanks for the quick reply. So I guess only solution is to roll back to v3.0.12 as in this repo. Though this message still appears, it build's fine I see.
❯ npx snowpack --version
[snowpack] 3.0.12
❯ npx snowpack build
[snowpack] config.mount[~/Desktop/11st-starter-kit/src/_site]: mounted directory does not exist.
[eleventy] Writing src/_site/404.html from ./src/404.md.
[eleventy] Writing src/_site/about/index.html from ./src/about.md.
[eleventy] Writing src/_site/index.html from ./src/index.md.
[eleventy] Copied 16 files / Wrote 3 files in 0.23 seconds (v0.12.1)
[snowpack] ! building source files...
[snowpack] ✔ build complete [1.21s]
[snowpack] ! building dependencies...
[snowpack] ✔ dependencies ready! [1.17s]
[snowpack] ! verifying build...
[snowpack] ✔ verification complete [0.00s]
[snowpack] ! writing build to disk...
[snowpack] ! optimizing build...
[snowpack] ✔ optimize complete [0.15s]
[snowpack] ▶ Build Complete!
Thanks, Snowpack v3.0.11 builds working for me!
So I guess only solution is to roll back to v3.0.12 as in this repo.
As long as I don't find a way to first build and then mount the code it seems this is the only viable option.
Found a workaround:
- By not using
'@snowpack/plugin-run-script'
but, to compile 11ty with npm. - Using 11ty's browserSync based dev server instead of snowpack's. Just had to set browserSync option
server: 'public'
, so that server starts from 'public/' instead of 'site/'.
Relevent scripts:
{
"scripts": {
"dev": "npm-run-all clean -p dev:*",
"dev:eleventy": "eleventy --serve",
"dev:snowpack": "snowpack build --watch",
"build": "eleventy && snowpack build",
},
}
Thank you for the food for thoughts!
I did a few changes and now I was able to update snowpack to its latest version.
I kept the development pipeline as is because it is working even if it is throwing a warning, but I explicitly triggered an eleventy build before running the snowpack build.
Now the eleventy files are written twice, but I'm fine with that as a workaround.
Have a look at #159