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

falling demo #25

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

falling demo #25

wants to merge 3 commits into from

Conversation

mightyaleksey
Copy link
Member

Hi, looks like I found a nasty bug :)

@mightyaleksey
Copy link
Member Author

Also I think, that _compose_node_module_cool_styles_foo__example is not a valid generated class name, because it is a part of the external module.

Took me some time figure out why that problem appear. When fetch() resolves path to the external module, which lies beyond the root directory, you usually get something like that: ../../node_modules/....
Later, when you pass it to postcss, something normalizes it to /node_modules/..., which makes it impossible to do futher resolutions.

{ [Error: ENOENT, open '/home/travis/build/css-modules/css-modules-loader-core/test/test-cases/compose-node-module/cool-styles/bar.css']
  errno: -2,
  code: 'ENOENT',
  path: '/home/travis/build/css-modules/css-modules-loader-core/test/test-cases/compose-node-module/cool-styles/bar.css' }

@mightyaleksey
Copy link
Member Author

I think that we should pass an absolute path to the source file as an extra argument to the parser plugin, so it can possible to put it back to the fetch() function:
https://github.com/css-modules/css-modules-loader-core/blob/master/src/index.js#L14
https://github.com/css-modules/css-modules-loader-core/blob/master/src/parser.js#L57

That will help us to resolve paths and build rootRelativePath. What you think about it?

importNode.each( decl => {
if ( decl.type == 'decl' ) {
this.translations[decl.prop] = exports[decl.value]
}
} )
importNode.removeSelf()
}, err => console.log( err ) )
Copy link
Member Author

Choose a reason for hiding this comment

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

We are handling error at the file-system-loader module, so no need to do it here.

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.

1 participant