Skip to content

Webpack Magic Comments? #85

Answered by webdiscus
rcherny asked this question in Q&A
Apr 4, 2024 · 3 comments · 3 replies
Discussion options

You must be logged in to vote

@rcherny

Here is additional info how it works with nested components.

In a complex use case, when used many components importing others components (nested components), then all nested imported styles will be joined in one singe CSS file with the name of the root JS file.

For example:

./main.js <= Entry point (root JS)
./component-a.js
...
./style.scss
./component-a1.scss
./component-a2.scss

The entry point (root JS file) ./main.js

import './style.scss'; // import CSS
import A from './component-a.js'; // import nested JS component containing owns styles

The nested child JS file ./component-a.js

import './component-a1.scss'; // import nested CSS
import './component-a2.scss'; // import nest…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@rcherny
Comment options

Comment options

You must be logged in to vote
2 replies
@rcherny
Comment options

@webdiscus
Comment options

Answer selected by rcherny
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants