-
Notifications
You must be signed in to change notification settings - Fork 511
Extract Text plugin does not work with async required files #106
Comments
|
I'm having the same problem here.. is this plugin not designed for this use-case? @geekyme how do you got around this? Thanks |
+1 Wondering if it's possible for ExtractTextWebpackPlugin to generate CSS files for each of the split points. |
That would be awesome! @gbrassey Have you maybe found your way around it? |
+1 |
+1 Wondering if it's possible for ExtractTextWebpackPlugin to generate CSS files for each of the split points. I really need this. |
+1, any solution for this? |
+1 |
3 similar comments
+1 |
+1 |
+1 |
@sokra why was this issue closed? I think your commit didn't addressed this. |
@sokra, issue is not fixed, please reopen this ticket |
thanks alot for reopening this ticket there are two parts to what I think folks are asking for, could you plz clarify if both are in scope of this ticket
|
I still think this issue should not be closed. tl;dr: Skip to the "So what do I want?" section if you're not interested in what I do not want :)For a rather large application, I want the amount of chunks loaded at startup to be as minimal as possible while still being able to dynamically load another chunk at runtime (e.g. on route changes). I do not want to use the At the same time, I do not want to have a "root" CSS (in my case LESS) file that knows about all other LESS files in that respective chunk. That would mean I'd have to to something like this: /* file: chunk-root.js */
// import components
import './a';
import './b';
// import "root" style for the chunk
import './chunk-root.less';
/* file: a.js */
// import another component here, as well
import B from './b';
// note: NO style import
export default class A {
constructor () {
const b = new B();
b.doStuff();
}
}
/* file: b.js */
// no style import here, either
export default class B {
doStuff() {}
}
/* file: chunk-root.less */
// ugh....
@import 'a.less';
@import 'b.less'; But I don't want to have two trees of files that someone needs to keep in sync - this kind of breaks the whole "bundler" idea, doesn't it? This also rules out loading the "root chunk" JS as well as the root chunk LESS manually, of course.
So what do I want?
config.entry= {
app: _src('app/index.ts'),
vendor: _src('app/vendor.ts'),
'page-one': _src('app/ui/pages/page-one/page-one.ts',
'page-two': _src('app/ui/pages/page-two/page-two.ts')
// ... and so on
};
new HtmlWebpackPlugin({
template: _src('app/index.html'),
excludeChunks: [
'page-one', 'page-two' // ... and so on
]
})
// e.g. in my router
require.ensure([], done, 'page-one'); Sadly, this will only download the .js file and I have no idea how to get the .css file.Especially if there's a |
I'm having the same problem!!!!! |
m2, do you have any solution ? |
@dalimian |
let's write this code--simple as that. This is the future of the extract text plugin. The code that needs to be edited is around here: One of these lines (possibly this one: We need to write it so if The thinking behind Anyway, we shouldn't be waiting around for the busy webpack people. Let's get this done. Anyone have any knowledge of how this all works? |
here's some additional notes on another issue regarding the same stuff: |
Any update or workaround for this to happen? |
2 thoughts brought by @renaesop
|
https://www.npmjs.com/package/extract-css-chunks-webpack-plugin is working well for me using Though I'm having troubles now with automatically generated async chunks (common code for multiple async chunks via CommonsChunkPlugin) as webpack only loads the JS. |
+1 |
DEPRECATED |
Use case:
sell.js
sell-form
child
Webpack:
I expected a main bundle to be built main-xxxx.js, main-xxxx.css and then chunks sell-form-xxxx.js and sell-form-xxxx.css to be built. However I realized the
cropper.css
above is being inline-d as a<style>
tag instead of being loaded as a<link>
stylesheetThe text was updated successfully, but these errors were encountered: