S
SolidJSโ€ข2y ago
siduck

solid-jsx not working

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/sid/my-app/node_modules/@mdx-js/rollup/index.js from /ho me/sid/my-app/vite.config.js not supported.
150 Replies
siduck
siduckโ€ข2y ago
@.high1 any idea? my vite config
import { defineConfig } from "vite";
import solidPlugin from "vite-plugin-solid";

import mdx from "@mdx-js/rollup";

export default defineConfig({
plugins: [solidPlugin(), mdx({ jsxImportSource: "solid-jsx" })],
server: {
port: 3000,
},
build: {
target: "esnext",
},
});
import { defineConfig } from "vite";
import solidPlugin from "vite-plugin-solid";

import mdx from "@mdx-js/rollup";

export default defineConfig({
plugins: [solidPlugin(), mdx({ jsxImportSource: "solid-jsx" })],
server: {
port: 3000,
},
build: {
target: "esnext",
},
});
siduck
siduckโ€ข2y ago
Brendan
Brendanโ€ข2y ago
Have you got "type": "module" in your package.json?
siduck
siduckโ€ข2y ago
oh cool the error is gone now!
Brendan
Brendanโ€ข2y ago
Feel free to close this thread if your query is resolved. Perhaps open another one if you have a different question.
high1
high1โ€ข2y ago
Thanks, @brendan_csel . There's a section dedicated to this in the beginning of the README file, Use mdx or xdm with solid-js. This module is ESM only, due to mdx and xdm being ESM only. Adding "type": "module" in package.json is one option.
siduck
siduckโ€ข2y ago
i tried this but i get some postcss error now
siduck
siduckโ€ข2y ago
high1
high1โ€ข2y ago
Well, if your project is a module, you need to be explicit it's postcss.config.cjs if you are writing common JS Or use a more modern syntax and postcss.config.js or mjs
siduck
siduckโ€ข2y ago
i renamed the file and i get this error now
siduck
siduckโ€ข2y ago
high1
high1โ€ข2y ago
It's the same issue. You really need to read ๐Ÿ˜„ these error messages. Just name it tailwind.config.cjs If something uses module.exports..., it's cjs
siduck
siduckโ€ข2y ago
oh i changed the syntax for both the files but i get the same error!
high1
high1โ€ข2y ago
You can use export default for tailwind and postcss, if you prefer that What did you do exactly?
siduck
siduckโ€ข2y ago
Want results from more Discord servers?
Add your server