Comments (9)
I believe it is not necessary. I will fix the import so we should not need the workaround.
from frontend-components.
The bug is fairly easy to solve by using import RuleTable from '@redhat-cloud-services/rule-components/RuleTable/RuleTable';
instead. Do we need to update the docs instead?
from frontend-components.
@bastilian any thoughts on this one?
from frontend-components.
@gkarat This import works because ESM should use shared style files with CJS, however, our babel plugin for translating scss imports work only with ... imports. And the RuleTable component includes a scss re-export for some reason. So it is a bug in the component, not a documentation change. 😏 By using the import, you actually use a wrong module version of the component (CJS modules are not intended for modern browsers) and it could introduce some unexpected errors (as you mix CJS/ESM components in your app) and bigger bundle size (some components will be bundled in both CJS&ESM versions.)
I made a fix that adds export translator: #1228 However, I am not sure if we want it and if we should not just import the scss file instead of re-exporting, but I am not absolutely sure why this change https://github.com/RedHatInsights/frontend-components/pull/390/files was ever made and if really need it now. @karelhala cc @Hyperkid123
from frontend-components.
Well the thing is, the build component should not even resolve the .scss
files but it should import only the .css
files. 🤔 maybe we forgot to add the custom loader for the rule-component
package? Gimme a sec to debug it.
from frontend-components.
@gkarat well I have found the issue. The RuleTable
component is re-exporting the scss file as style
. I am not but I am 100% sure it won't work with CSS modules which is the only thing I can imagine this would be useful.
This fixes the problem
diff --git a/packages/rule-components/src/RuleTable/RuleTable.js b/packages/rule-components/src/RuleTable/RuleTable.js
index 760e6e7f..003e24c0 100644
--- a/packages/rule-components/src/RuleTable/RuleTable.js
+++ b/packages/rule-components/src/RuleTable/RuleTable.js
@@ -11,7 +11,7 @@ import flatten from 'lodash/flatten';
import debounce from 'lodash/debounce';
import isEqual from 'lodash/isEqual';
import { calculateMeta, calculateActiveFilters, createRows } from './helpers';
-export { default as style } from './index.scss';
+import './index.scss';
class RuleTable extends Component {
state = {
Before I apply it @akofink @gkarat is there any reason why the styles are re-exported?
from frontend-components.
@Hyperkid123 Check the PR I mentioned before: https://github.com/RedHatInsights/frontend-components/pull/390/files
from frontend-components.
Yeah, I saw it but it won't really help with the problem. The rule component is using CSS modules syntax but the component nor the library is set up to use/build CSS modules. If you want to consume the scss, you can import it into the project and go from there. SCSS files are available.
from frontend-components.
@Hyperkid123, @rvsia, thanks a lot for the clarification. I cannot comment anyhow on the necessity of re-export in this case.
from frontend-components.
Related Issues (20)
- ### TagWithDialog.tsx HOT 3
- ### ConnectedBreadcrumbs.tsx HOT 2
- ### SimpleTableFilter.test.tsx HOT 2
- ### index.tsx HOT 3
- ### WithHistory.tsx HOT 2
- ### ViewAffectedLink.tsx HOT 1
- ### InsightsLabel.tsx HOT 2
- ### NotAuthorized.tsx HOT 2
- ### Spinner.tsx HOT 2
- ### RebootRequired.tsx HOT 2
- ### WithOuia.test.tsx HOT 1
- ### TableToolbar.tsx HOT 4
- ### TemplateProcessor.tsx HOT 1
- ### Battery.tsx HOT 5
- ### ErrorBoundary.test.tsx HOT 1
- ### MediumBattery.tsx HOT 1
- ### Ansible.tsx HOT 1
- ### NullBattery.tsx HOT 1
- frontend-components-remediations should list @scalprum/react-core as the package dependency
- axios security issue HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from frontend-components.