-
Notifications
You must be signed in to change notification settings - Fork 161
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
@CssImport breaks if you add 'css-loader' to webpack #6276
Comments
Can be fixed by generating code like
instead of
|
Hello, I just stumbled upon this issue when trying to use Webpack css-loader. So far I could do
to be able to use bootstrap styling. After installing the css-loader it stopped working - now I know why. Anyhow, my intention was to use ES6 imports in a index.js to import all necessary js libraries and stylesheets and than having only one @javascrip annotation including this file. This is why I installed the css-loader in first place. I do not not get the workaround and how can it be used with css files installed with npm |
The fix code above is a suggestion for the code generated by Flow, it is not a workaround for a project |
@karlitos: For your project’s workaround, I suppose you could make the css-loader glob more strict so that it only matches the style sheets that are loaded by the index.js For example (replace webpack.config.js
|
Related to issue vaadin-learning-center/crm-tutorial-typescript#8 we're thinking about making Flow by default use a loader chain of But I'm wondering what was the original use case behind this issue, as in can we get this issue resolved by doing this? Is it about getting If the user wants to customize it further in a way that the JS import of a CSS file doesn't return a plain CSS string I think it would make sense to recommend overriding the CSS loader in project config only for specific directories/files in that case. |
I think my original case was using monaco-editor that says in the installation instructions at https://github.com/microsoft/monaco-editor/blob/master/docs/integrate-esm.md that you should use
|
@Artur- Thanks for the context. In that case I would guess that monaco-editor itself depends on |
I think Flow can assume a specific format for webpack CSS loader output. If the user modifies the loader configuration they should make sure that the output of their loader configuration (for any CSS files imported using Flow features like It should be ok to modify global CSS loader config as long as the output format stays compatible. If the user wants or needs specific CSS files to be loaded differently, they should make sure their loader config overrides only affect those files to not break Related: #8843 |
If you add
css-loader
to your webpack config, Flow automatically starts using that for@CssImports
and instead of CSS, creates style tags like this:Example project: https://github.com/Artur-/test-css-import-css-loader
The text was updated successfully, but these errors were encountered: