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

CSS imports #31

Open
wants to merge 17 commits into
base: v4
Choose a base branch
from
Open

CSS imports #31

wants to merge 17 commits into from

Conversation

sgratzl
Copy link
Collaborator

@sgratzl sgratzl commented Feb 3, 2021

based on #29

parses @import './test.css' lines in CSS files and adds them as imports within rollup,

e.g.,

@import './test.css';
@import '~test_module/test.css';
.root {
  color: red;
}

will create the following intermediate JS module

import './test.css';
import 'test_module/test.css'; // note the ~ was removed similar how css-loader is handling imports
export default '';

Thus, triggers import the imported files during bundling.

src/index.js Outdated Show resolved Hide resolved
src/index.js Outdated Show resolved Hide resolved
src/index.js Outdated

return {
name: 'css',
buildStart() {
hasChanged = false
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a build takes 10s and you save an irrelevant file after 5s, hasChanged will be false at the moment that generateBundle takes place. I think this might introduce a race-condition. Does this change address a bug in the current version?

Maybe we should remove all change detection to make things simpler?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That change is from my pull request. You raise a good point, I’ll think about what to do about this and update my PR

src/index.js Outdated Show resolved Hide resolved
@thgh
Copy link
Owner

thgh commented Feb 3, 2021

Can you further discuss this with @jerekshoe and merge it into the v4 branch?

@thgh thgh changed the base branch from master to v4 February 3, 2021 13:56
sgratzl and others added 2 commits February 3, 2021 16:45
Co-authored-by: Thomas Ghysels <info@thomasg.be>
thgh
thgh previously approved these changes Feb 5, 2021
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 this pull request may close these issues.

None yet

3 participants