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

@apply leads to different chunks' content after each build #3349

Closed
hivokas opened this issue Jan 13, 2021 · 1 comment · Fixed by #3356
Closed

@apply leads to different chunks' content after each build #3349

hivokas opened this issue Jan 13, 2021 · 1 comment · Fixed by #3356

Comments

@hivokas
Copy link
Contributor

hivokas commented Jan 13, 2021

Describe the problem:

I've noticed an issue in the project I'm working on right now.

A couple of things about the project:

  • we store compiled assets in the repo;
  • we use GitHub Actions to automatically compile assets once changes are pushed to the PR;
  • we use Laravel Mix to compile assets;
  • we use TailwindCSS 2, Vue.js 2,
  • we use code-splitting (via import()) to split the code into small chunks.

The problem is that once assets are compiled, every Vue component that contains @apply leads to changes in 2 files: [chunkname].chunk.js & [chunkname].chunk.js.map. We have many components with @apply statements that lead to ~120 changed files in each PR that contains front-end changes (it makes the code-review process harder).

Here is what I've noticed so far. When we use @apply in the styles of the component, the resulting chunk is different after each build.

And the difference lays here:

image

Looks like this string is Input#id generated by PostCSS (https://postcss.org/api/#input-id) and is different after each build.

Is that something that can be fixed on the TailwindCSS side?

Link to a minimal reproduction:

I've created a repository to demonstrate the problem.

https://github.com/hivokas/laravel-mix-playground-random-postcss-input-id

Use mix --production to build assets.

@hivokas hivokas changed the title @apply leads to dif @apply leads to different builds Jan 13, 2021
@hivokas hivokas changed the title @apply leads to different builds @apply leads to different chunks content after each build Jan 13, 2021
@hivokas hivokas changed the title @apply leads to different chunks content after each build @apply leads to different chunks' content after each build Jan 13, 2021
@hivokas
Copy link
Contributor Author

hivokas commented Jan 14, 2021

I think the reason for random input ID for each build leads here:

.process(requiredTailwindAtRules.map((rule) => `@tailwind ${rule};`).join('\n'), {
from: undefined,
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant