-
-
Notifications
You must be signed in to change notification settings - Fork 387
Closed
Description
I don't think the browser needs to make extra an request to fetch the css file of its own async js chunk which it has been loaded. So I want to disable.
It should be something like the "fallback" option of extract-text-webpack-plugin
and its behavior. However, I'm not able to find an equivalent way with mini-css-extract-plugin
and webpack 4.
For example, let's say we have several pages will be loaded on demand:
// routes.js inside intial-chunk.js
import './initial-chunk.css';
const routes: [
{
module: () => import('pageA')
}
];
// pageA.js
import './pageA.css';
export default {
// something that pageA should do
};
// pageB.js
import './pageB.css';
export default {
// something that pageB should do
};
And the output files should be like this:
vendor.js
initial-chunk.js
initial-chunk.css
pageA.js
pageB.js
// Note that there isn't a "pageA.css" or "pageB.css" file. These css files are inside their own chunks and loaded by some other loaders, `style-loader` for example
How can I achieve this? Thank you very much.
Activity
alexander-akait commentedon Mar 28, 2019
Please use gitter or stackoverflow for questions, it is bug tracker, thanks!
You
style-loader/url
orstyle-loader/usage
.jcreamer898 commentedon Apr 24, 2019
Was there a resolution on this? We have a bunch of dynamic imports, and they're each getting their own CSS files and I'd like to bubble them up to their closest entrypoint, but haven't been able to find the right config to achieve it.
lsycxyj commentedon Jul 21, 2019
@jcreamer898 I've never found the right config to solve this problem with
style-loader
. So I tried to create a pull request #432 to solve it.yanguoyu commentedon Aug 29, 2019
maybe you can use this, it work for me. only create two css. not 1.css, 2.css, 3.css....
lsycxyj commentedon Aug 29, 2019
In this way, you will have to load a lot of other css rules when you don't need.
yanguoyu commentedon Aug 29, 2019
is this not your want?
lsycxyj commentedon Aug 30, 2019
No, I want to load css modules only when you need