Skip to content

Import CSS modules as global to prevent rewriting classnames#10026

Merged
dennisoelkers merged 2 commits intomasterfrom
prevent-generated-classnames
Feb 8, 2021
Merged

Import CSS modules as global to prevent rewriting classnames#10026
dennisoelkers merged 2 commits intomasterfrom
prevent-generated-classnames

Conversation

@Gaya
Copy link
Copy Markdown
Contributor

@Gaya Gaya commented Feb 8, 2021

Description

This will address the issue raised by @kyleknighted in #10023

Like before, some modules where being imported with generated classnames in develop target. I disabled it here and it solved the issue.

@dennisoelkers I am not totally sure why the options were different for develop, but maybe you know more about this and how this solution might be wrong.

Fixes #10023

Motivation and Context

CSS modules were imported incorrectly and got generated classnames

How Has This Been Tested?

By looking up the DatePicker and fixing the imported CSS classes.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

Copy link
Copy Markdown
Contributor

@kyleknighted kyleknighted left a comment

Choose a reason for hiding this comment

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

this is working good for me

Copy link
Copy Markdown
Member

@dennisoelkers dennisoelkers left a comment

Choose a reason for hiding this comment

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

Works, but maybe we can simplify the change (see inline).

// eslint-disable-next-line import/no-dynamic-require
const BOOTSTRAPVARS = require(path.resolve(ROOT_PATH, 'public', 'stylesheets', 'bootstrap-config.json')).vars;

const getCssLoaderOptions = () => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we could keep this function. The culprit seems to be css-loader defaulting to mode: 'local', that is why the modules: 'global' (which is an abbreviation for modules: { mode: 'global' } fixes it. Maybe we can keep localIdentName for dev and just return mode: 'global' for all modes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Picked it up in the last commit. I agree with the solution 😊

@Gaya Gaya requested a review from dennisoelkers February 8, 2021 13:22
Copy link
Copy Markdown
Member

@dennisoelkers dennisoelkers left a comment

Choose a reason for hiding this comment

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

Looks good, works well! Thanks a lot! 🎉

@dennisoelkers dennisoelkers merged commit 7b0232f into master Feb 8, 2021
@dennisoelkers dennisoelkers deleted the prevent-generated-classnames branch February 8, 2021 14:47
dennisoelkers added a commit that referenced this pull request Feb 8, 2021
* Use jest plugin for ESLint. (#10018)

* Improving typing of field type properties. (#10015)

* Update css-loader, less-loader, style-loader dependencies and configuration (#8875)

* updated dependencies

* fix import style

* fix less and style loader options

* remove icon font path

* ability to load eot

* add lazy loading capability

* support leaflet lazy

* use new style of importing lazy

* fix insertAt definitions

* add comment why

* ignore lazy loading files for normal css

* update how to import modules

* update importstyle leaflet

* update import style editwidget

* updated lock file

* fix webpack config for leaflet

* fix lazy loading in jest

* fix linting

* add no-alert exception to ignore

* fix flow module mapping

* update style-loader to latest

* update css-loader

* fix lazy loading jest module

* update requires to import

* set css module class transformation to be global

* Fixing loading spinner gap between icon and text (#10025)

* Fixing linter hints related to importing `URLUtils`/`FormsUtils`. (#10021)

* Import `URLUtils` properly.

* Using correct ESLint rule to disable for TS.

* Avoid calling hook conditionally.

* Avoid calling hook conditionally.

* Fixing linter hints.

* Removing unused import.

* Fixing default import of `FormsUtils`.

* Making `no-unused-vars` consistent for TS.

* Import CSS modules as global to prevent rewriting classnames (#10026)

* import css modules as global

* revert to using css options generate

* Add highlight creation form

* Add highlighting condition

* Implement conditional highlighting rules

* Move Highlighting Form to a modal

* Add validation for required fields

* Add condition to the backend

* Make rule editiable and fix some styling issues

* Fix test and create a new one

* Add minimal tests for HighlightForm

* Fix linter warning

* Introduce a enum for the condition

* Add missing license

* Fix highlighting aggregation fields (count())

* Make the tests better than before

- sort our fields
- use update action from store
- make update action usable

* Fix typescript and linter

* Fix test fallout after updateing update store function

* Add expect as expected from lint

* Add description about rule order

* Fix wrong initize value

* Choose random color when creating new HighlightingRule

Co-authored-by: Dennis Oelkers <dennis@graylog.com>
Co-authored-by: Gaya Kessler <gaya@theclevernode.com>
Co-authored-by: Linus Pahl <linus@graylog.com>
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.

style-loader update stopped node_module CSS from loading

3 participants