Open mizdra opened 1 month ago
In css-loader@7, namedExport now defaults to true (I'm not sure of the motivation behind this change.).
css-loader@7
namedExport
true
So css-loader@7 forces you to import CSS Modules files as follows:
import * as styles from './foo.module.css';
On the other hand, happy-css-modules generates .d.ts with default export.
happy-css-modules
.d.ts
https://github.com/mizdra/happy-css-modules/blob/613391616b299a6fe2f10598a8da85e5a1b0e728/packages/example/01-basic/1.css.d.ts#L1-L21
Therefore happy-css-modules forces you to import CSS Modules files as follows:
import styles from './foo.module.css';
This causes compatibility problems.
I don't know how to solve this.
happy-css-modules previously supported --namedExport option. However, it was removed due to problems with definition jumps not working.
--namedExport
I think it would be best to bring back this option and make definition jumps work as well. However, I am not sure if that is possible.
Please set the namedExport option to false in css-loader.
false
Background
In
css-loader@7
,namedExport
now defaults totrue
(I'm not sure of the motivation behind this change.).So
css-loader@7
forces you to import CSS Modules files as follows:On the other hand,
happy-css-modules
generates.d.ts
with default export.https://github.com/mizdra/happy-css-modules/blob/613391616b299a6fe2f10598a8da85e5a1b0e728/packages/example/01-basic/1.css.d.ts#L1-L21
Therefore
happy-css-modules
forces you to import CSS Modules files as follows:This causes compatibility problems.
Solution
I don't know how to solve this.
happy-css-modules
previously supported--namedExport
option. However, it was removed due to problems with definition jumps not working.I think it would be best to bring back this option and make definition jumps work as well. However, I am not sure if that is possible.
Workaround
Please set the
namedExport
option tofalse
in css-loader.