You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not really sure of the entire flow of this issue as the whole webpack compilation flow is a bit too magical for me to completely comprehend 100%. But what seems to be happening in our case is that files references inside previously cached Vanilla extract CSS files aren't emitted during a consecutive build and fails with an error like this:
RealContentHashPlugin
Some kind of unexpected caching problem occurred.
An asset was cached with a reference to another asset (a89d799b) that's not in the compilation anymore.
Either the asset was incorrectly cached, or the referenced asset should also be restored from cache.
Referenced by:
- static/css/0a230cf04b9515d0.css: ...onts/roboto-regular-a89d799b.woff) format("woff"...
I've added a minimal reproduction in the referenced repository, essential parts of the configuration are inside next.config.js where I've set up a custom loader for font files like this:
Then I add a globalFontFace rule which I include in the _app.tsx. Running npm run build works the first time, but the second time it fails with the error given above (it build again after deleting the .next folder).
When I switch the setup to use native CSS modules everything works fine (see the css-modules branch of the reporoduction repo).
Additionally I have to disable outputFileTracing when using the vanilla extract setup with our custom loader, but that might be a different issue...
sjaq@ontuig ~/Code/Projects/ve-reproduction (main) $ npm run build # First run> ve-reproduction@0.1.0 build
> next build
- warn You have enabled experimental feature (appDir) in next.config.js.
- warn Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.
- info Linting and checking validity of types
- info Creating an optimized production build
- info Compiled successfully
- info Collecting page data
- info Generating static pages (3/3)
- info Finalizing page optimization
Route (pages) Size First Load JS
┌ ○ / 4.22 kB 77.4 kB
├ └ css/e16d911485b9f398.css 46 B
├ /_app 0 B 73.1 kB
├ ○ /404 182 B 73.3 kB
└ λ /api/hello 0 B 73.1 kB
+ First Load JS shared by all 73.3 kB
├ chunks/framework-305cb810cde7afac.js 45.2 kB
├ chunks/main-3719bec94bd586eb.js 26.9 kB
├ chunks/pages/_app-b4232248edcac9c3.js 298 B
├ chunks/webpack-8fa1640cc84ba8fe.js 750 B
└ css/33ea05cb1cdc6779.css 161 B
λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
○ (Static) automatically rendered as static HTML (uses no initial props)
sjaq@ontuig ~/Code/Projects/ve-reproduction (main) $ npm run build # Second run with cached assets> ve-reproduction@0.1.0 build
> next build
- warn You have enabled experimental feature (appDir) in next.config.js.
- warn Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.
- info Linting and checking validity of types
Failed to compile.
RealContentHashPlugin
Some kind of unexpected caching problem occurred.
An asset was cached with a reference to another asset (ea0ede1f) that's not in the compilation anymore.Either the asset was incorrectly cached, or the referenced asset should also be restored from cache.Referenced by: - static/css/0a230cf04b9515d0.css: ...onts/roboto-regular-ea0ede1f.woff2) format("woff...RealContentHashPluginSome kind of unexpected caching problem occurred.An asset was cached with a reference to another asset (a89d799b) that's not in the compilation anymore.
Either the asset was incorrectly cached, or the referenced asset should also be restored from cache.
Referenced by:
- static/css/0a230cf04b9515d0.css: ...onts/roboto-regular-a89d799b.woff) format("woff"...
> Build failed because of webpack errors
- info Creating an optimized production build .%
Validations
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Describe the bug
I'm not really sure of the entire flow of this issue as the whole webpack compilation flow is a bit too magical for me to completely comprehend 100%. But what seems to be happening in our case is that files references inside previously cached Vanilla extract CSS files aren't emitted during a consecutive build and fails with an error like this:
I've added a minimal reproduction in the referenced repository, essential parts of the configuration are inside
next.config.js
where I've set up a custom loader for font files like this:Then I add a
globalFontFace
rule which I include in the_app.tsx
. Runningnpm run build
works the first time, but the second time it fails with the error given above (it build again after deleting the .next folder).When I switch the setup to use native CSS modules everything works fine (see the
css-modules
branch of the reporoduction repo).Additionally I have to disable
outputFileTracing
when using the vanilla extract setup with our custom loader, but that might be a different issue...Reproduction
https://github.com/sjaq/ve-reproduction
System Info
Used Package Manager
npm
Logs
Validations
The text was updated successfully, but these errors were encountered: