-
Notifications
You must be signed in to change notification settings - Fork 922
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
[BUG] plugin-run-script not waiting for eleventy to finish during build #3095
Comments
I'm running into this error too, though I discovered it through building from scratch. I can indeed recreate this with the above steps though. I'd add one correction that might illuminate the possible solution though. On step 2, you don't need to actually remove rm -r _output, you can just empty the folder and leave it there. The result will be the same. What's looking to be happening is the eleventy compilation is finishing after snowpack is done, so the eleventy files eventually end up there, but Snowpack is already done with its work and isn't waiting on eleventy to be finished. If you were to run snowpack build twice, it would work as the eleventy files would have been built as well from the first build. Also, seconding the "snowpack is a joy to use!" sentiment. |
Thanks for sharing @chrisparsons83! You're right, eleventy does seem to run. I tried it again a few times since posting and I always get one of the following results on the first run (i.e. when
On the second run, it's usually (3), but sometimes still (2). I should add that it's a small site with few dependencies at this point, so both Snowpack and eleventy are done very very quickly. I agree that sounds like a race condition where Snowpack doesn't wait for eleventy to finish, so you'll get whatever happens to be in |
I was trying to get to the bottom of a potentially similar bug after looking at a different starter project while rolling my own. And I ended up here. I found the culprit to be the version of snowpack. Up to version 3.0.13 worked fine. 3.1.x, 3.2.x stopped it working as expecting (in my situation, it was still compiling 11ty files, but wouldn't live reload). |
@willans Good catch! Can confirm downgrading to 3.0.13 does the trick for me. I did some digging through the diffs since v3.0.13. As far as I can tell the logic for building has since been moved from // Wait for the job to complete before continuing (unless in watch mode)
if (!isDev) {
await runJob;
} This or something equivalent is missing from the current version of I tried the naive fix of just adding it again in
|
not a fix for this but another workaround is to add this to the package.json
|
Same issue here with a from-scratch project using eleventy. Downgrading snowpack to 3.0.x did the trick for me. I have to say that this is a rather worrying issue and fortunately I came across this bug. |
Quick update: I managed to resolve the mounting error I mentioned above by delaying mounting until after the plugins have finished (here). I'm not sure if this fix will work for all plugins because I don't know if plugins can make use of mounting themselves, but I didn't see anything so far. That solves the However after updating my fork with the latest version from upstream I now have a similar problem with I have the same behavior in my website project with the unchanged snowpack version, so it isn't caused by my changes. With |
would love to see this working with dev |
This issue is clear on dev in my repo also. Reload works with the index, but if you edit a page with shortcodes like edit: |
Bug Report Quick Checklist
Describe the bug
Hello! I'm building a small site with 11ty and Snowpack based on app-template-11ty. The only change I made to the template is to add the eleventy output in
_output
to.gitignore
, because I prefer not to commit auto generated files.Everything works fine during development.
When I deploy the page all eleventy generated files are missing from the result. I noticed that
@snowpack/plugin-run-script
doesn't seem to executeeleventy
duringsnowpack build
. I do get a log output[snowpack] starting eleventy run() workers
, but the contents of_output
remain unchanged, i.e. remain in whatever state they were when I last ransnowpack dev
.To Reproduce
npx create-snowpack-app 11ty-test --template @snowpack/app-template-11ty
rm -r _output
snowpack build
build
only contains_snowpack
anddist
folders, but no eleventy stuffExpected behavior
snowpack build
should behave likesnowpack dev
and run eleventy.Anything else?
The description of the plugin and this issue suggest that the above indeed the intended behavior. What confuses me a bit is that if that's true, why include
_output
in the template repository in the first place?Workaround: Changing the
npm build
script toeleventy && snowpack build
Either way thanks for all the work you put into this, all in all snowpack is a joy to use!☺️
The text was updated successfully, but these errors were encountered: