-
Notifications
You must be signed in to change notification settings - Fork 71
Generated typings not compatible with project #20
Generated typings not compatible with project #20
Comments
can you paste the generated typings here? |
Example:
The thing I don't understand about this output is that The generated typings for |
I think it's because I'm using
If I understand the comment in the documentation about exports being extracted out of But does this mean there's no way to use non- |
need to look into this when i find the time! |
i see the same thing without using style-loader or postcss just fyi my config with postcss commented out for testing:
passing the above to extract text plugin |
css-loader exports mappings to exports.locals, not to exports.default
any idea how to fix that @scamden ? |
sorry for the delay. many build issues to figure out at the moment :P did you happen to see my comment on 81ff68c? i'm not too sure but i think this commit is just wrong? css-modules seems to export not on a locals object at all but just at the root of the module. let me know if i'm missing something about how this all works but maybe the fix is to just revert this commit and go back to exporting as default? |
@scamden Actually |
@aaronbeall that makes sense. unfortunately it still leads to a bug right? because ultimately ts won't let me get the css class off the default object and if I use the locals object as the types suggest it fails at runtime (since they are not actually there after extract text loader runs). if you determined that this was ultimately correct how did you remedy? @timse is there a way to perhaps add a flag for style / extract text mode? |
@scamden That's what |
well unfortunately it's not all it does haha. it also causes classnames using reserved js keywords to fail. i would love to use namedExports, but it's not compatible with twitter bootstrap for example which uses the classname "in" for modal animations. would be awesome to have an option not to use named export but still export the big map object as default for loaders that expose it that way |
Yeah, you're right. I guess there's just no way to use named exports with reserved words. It is possible to export top level reserved word keys, though, using
That could be a new option? As for the |
(Secretly I did eventually change the classname in, thankfully we have a copy of bootstrap and are not compiling it directly from source but it does still seem like a bug for others) |
Is there anyone who's actually using this without the I think there really needs to be an option to toggle this behavior. I would happily use |
When using the `style-loader`, the `locals` object gets invisibly murdered. Fixes Jimdo#20. If someone's not using the `style-loader` they can `import {locals}`, and if they _are_ using the `style-loader`, they can use the default import. This should make everyone happy, and be fully backwards-compatible.
@sarink extract text plugin is the alternative |
I am using this loader setup for TypeScript and PostCSS with Webpack 1.13.1:
(The commented out css loader is the previous setup which works without CSS modules.)
When I import a .css file using
import {locals as styles} from "./example.css"
as the generated typings indicate, I get nothing at runtime. If I useimport * as styles from "./example.css"
I see all the class names at runtime, but still nolocals
, and TypeScript flags errors for all references, such asstyles.myClassName
.The text was updated successfully, but these errors were encountered: