Skip to content
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

Infinite loop when use composes for extract class from external file #50

Closed
lorenzomigliorero opened this issue May 29, 2017 · 1 comment

Comments

@lorenzomigliorero
Copy link

lorenzomigliorero commented May 29, 2017

Hi,
i have several problem when use composes from external file.
Try to explain the issue....

This is my configuration:

.babelrc

"css-modules-transform", {
  "preprocessCss": "./tools/preprocess/babel-scss.js",
  "generateScopedName": '[hash:base64:5]',
  "extensions": [".scss"]
}

babel-scss.js

module.exports = (data, file) => {

	try {
		
		return sass.renderSync({
			data,
			file
		}).css.toString('utf8');
	
	} catch (e) {
		
		console.error(e);
	
	}

};

module.scss

.header {
	composes: font-size-sm '../../styles/modules/_font-size.scss';
}

_font-size.scss

.font-size-sm  {
   font-size: 1rem;
}

This configuration generate an infinite loop:

C:\xampp\htdocs\react-redux-universal-hmr-boilerplate\src\components\Box\Box.scss
C:\xampp\htdocs\react-redux-universal-hmr-boilerplate\src\styles\modules\_font-size.scss
C:\xampp\htdocs\react-redux-universal-hmr-boilerplate\src\styles\modules\_font-size.scss
C:\xampp\htdocs\react-redux-universal-hmr-boilerplate\src\styles\modules\_font-size.scss
C:\xampp\htdocs\react-redux-universal-hmr-boilerplate\src\styles\modules\_font-size.scss
C:\xampp\htdocs\react-redux-universal-hmr-boilerplate\src\styles\modules\_font-size.scss
infinite loop.....
  • "babel-cli": "6.24.1",
  • "babel-core": "6.24.1",
  • "babel-loader": "7.0.0",
  • "babel-plugin-css-modules-transform": "1.2.7"

Any suggestions?
Thanks

@michalkvasnicak
Copy link
Owner

@lorenzomigliorero this should be caused by this plugin because we are using css-modules-require-hook under the hood. Could you please create a minimum repository to reproduce this problem?

Sorry for late response, I'm quite busy these days.

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

No branches or pull requests

2 participants