Modifying values outside of a module doesn't update the component styles
See original GitHub issueDescribe the bug
When developing (using Parcel) in a component and modifying some properties outside of the module that are imported - don’t end up recompiling the component - thus they don’t get updated.
// colors.tsx
export const heroBackground = 'linear-gradient(120deg,blue 0%, #8fd3f4 100%)';
// hero.tsx
import React from 'react';
import '@compiled/core';
import { heroBackground } from '../utils/colors';
export const Hero = ({ children }: { children: React.ReactNode }) => {
return (
<div
css={{
background: heroBackground,
}}>
{children}
</div>
);
};
What’s worse - sometimes you get into a state where it just won’t update. In this case is it our caching behaviour, or is it the bundler? Both?
To Reproduce Steps to reproduce the behavior:
- Use code above
- Run with your favourite bundler
- Update hero background
- Notice that the component doesn’t have the updated color
- Now modify hero component
- Notice that is now is updated as expected
Expected behavior
It should update the component color without needing the modify the component file.
Additional context
Not sure what we can do here. Is it possible to fix this if we create a bundler plugin to make sure any depending module gets re-transformed if something changes?
Questions
- Does this also affect Webpack
- How can we force a bundler to recompile a consuming module (so it runs the Babel plugin over it, again)
Issue Analytics
- State:
- Created 3 years ago
- Comments:8
Top Results From Across the Web
function change $scope variable , but do not update the value ...
I have a little problem here, ng-click function change the scope value inside the function but does not update the scope value outside...
Read more >CSS Module styles do not update upon saving file in ... - GitHub
When changing and saving CSS Module file the style change does not get reflected to current open page in development.
Read more >Solving the React Error: Not Picking Up CSS Style | Pluralsight
In this guide, you will learn about the errors that can occur while importing a CSS file into your React file.
Read more >Component styles - Angular
Sometimes it's useful to apply styles to elements within a component's template based on some condition in an element that is an ancestor...
Read more >Chapter 4, Understanding and Using Angular Components
The selector takes a string value, which is the CSS selector Angular will use to identify the element. The recommended practice when we...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hi all the webpack loader for Compiled is nearing completion, see: https://github.com/atlassian-labs/compiled/pull/530
If I cut a nightly would anyone want to have a play? Or alternatively grab the branch and play locally?
Confirmed
addIncludedFileis what we’re interested in https://github.com/parcel-bundler/parcel/discussions/5677