Skip to content

Custom module export support #645

Closed
Closed
@ZeeCoder

Description

@ZeeCoder

I'm not sure if I'm opening this issue at the right place, but I'm not certain where else could I address this issue.

My goal
I wanted to make a custom loader, that would allow me to import some statistics from a css file, like so:
import stats from 'MyComponent.css';
This setup would also involve style-loader and css-loader so that my css is injected in the browser.

The issue
It seems like due to the tight coupling of the style-loader and css-loader in module: true mode, I can't define custom exports like I wanted to.

I thought even the following would be possible:
import { loader1Data, loader2Data } from 'MyComponent.css';
Where those imports are whatever the respective chained loaders decided to expose.

Question
Would the above be possible somehow?
To me it seems like this would need a rewrite and some standard that loaders working on CSS would need to follow in order to contribute to a module that's finally exported at the end.

I'm really interested in any thought, or advice on who I need to approach with this problem.

Also, this is the original discussion on the webpack/dev Gitter:
https://gitter.im/webpack/webpack/dev?at=5a2c9ce93a80a84b5bdac9ef

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions