Hello. I am writing a component library based on Monday’s UI library for customized use in my apps. I am facing an error importing monday-sdk
and bundling it will rollup
.
Here is my rollup config:
import typescript from "@rollup/plugin-typescript";
import {nodeResolve} from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import {terser} from "rollup-plugin-terser";
import postcss from "rollup-plugin-postcss";
const config = {
input: "src/index.ts",
output: :
{
file: "dist/bundle.cjs.js",
format: "cjs",
},
{
file: "dist/bundle.esm.js",
format: "esm",
},
],
external: :"react", "react-dom", "monday-sdk-js"],
plugins: :
nodeResolve(),
commonjs(),
typescript({
include: :"*.ts+(|x)", "**/*.ts+(|x)"],
tsconfig: "./tsconfig.json",
}),
terser(),
postcss({extensions: :".css"]}),
],
};
export default config;
in my file I just imported it
// container.tsx
import mondaySdk from "monday-sdk-js";
And here is the error in the console on running rollup -c
:
src/index.ts → dist/bundle.cjs.js, dist/bundle.esm.js...
!] Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
src/components/Tooltip/Tooltip.tsx (4:7)
2: import {Tooltip as MondayTooltip} from "monday-ui-react-core";
3: import "monday-ui-react-core/dist/main.css";
4: export interface TooltipProps {
^
5: content: string;
6: children: React.ReactElement;
Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
I isolated the issue by commenting out the sdk import statement, and saw that the bundling had completed without any error.
Please help. Thanks in advance!