-
Notifications
You must be signed in to change notification settings - Fork 0
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
SCSS modules in CommonJS #1
Comments
FYI, I think the key part in this package which triggers the error is: // node_modules\@teambit\design.themes.base-theme\dist\circular-font\index.js
const circular_font_module_scss_1 = __importDefault(require("./circular-font.module.scss")); To minimize the reproduction, you can change the file into: // node_modules\@teambit\design.themes.base-theme\dist\circular-font\index.js
"use strict";
const circular_font_module_scss_1 = require("./circular-font.module.scss");
console.log(circular_font_module_scss_1);
module.exports = circular_font_module_scss_1; and write in the entry file: import '@teambit/design.themes.base-theme/dist/circular-font/index' if the SCSS module is required properly, you should see an object with all the classnames as keys logged in the console. |
Sorry, I think my analysis was wrong yesterday. The actual error should be that maybe we forgot to configure the vite plugin, we both made that mistake.
export default defineConfig({
// ...
plugins: [
// ...
cjs2esm.vitePlugin()
],
optimizeDeps: {
esbuildOptions: {
plugins: [
cjs2esm.esbuildPlugin({
// ❗️❗️❗️❗️❗️❗️ following means that let `esbuild` handle cjs in `react` lib
filter: /!react/
})
]
}
}
}) |
Would you mind checking again? Here is my reproduction: https:/Jinjiang/reproductions/tree/vite-plugin-cjs2esm-20230613 (I honestly didn't get what the filter The error log:
Thanks. |
I am debugging and found that import result is undefined although it work. And I also think it needs vite support. The plugin level can not do transform. |
vitejs/vite#13519 |
Hi, I'm from this issue vitejs/vite#13298 hope you don't mind.
Here is a real case that still got an error:
You can install this package via:
after that, import this package as a React component, you still got the error with your plugin
the error:
Do you think it could be possibly supported by your plugin?
Thanks.
The text was updated successfully, but these errors were encountered: