-
-
Notifications
You must be signed in to change notification settings - Fork 232
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
Uncaught TypeError: module.exportDefault is not a function #1213
Comments
Thank you for raising this. I will take a look. |
I can reproduce it but I have no idea why this happens. I will create an issue in meteor and see if someone from meteor could help. |
Closing as this is an issue with ESM support in Meteor. |
Is there a way to solve this from the Remirror side? At least temporary! |
@strdr4605 Could you open a new issue with a mini reproduction? Thanks! |
The steps to reproduce are the same. Do I really need to open a new issue? Maybe reopen this one? |
If you have the I can think of one workaround. You can create a separate git repo for your React editor component. This git repo is an NPM package that imports Remirror as a dependency as well as some of your own code. When building this package, embed the dependencies into the output file (for example, you can use ESbuild and the By doing that, you can not only split up the complex editor logic, but also removed these |
Thanks for the explanation, I will see if this option works for my use case. |
While working on a POC, I wasn't able to configure a separate package with remirror editor. I tried webpack, rollup, esbuild, but all result in a |
Just to let you know: the easiest solution I found is to override
I attached a prepared package for you (you can skip step 1-3 in this case). I didn't add any bloatware or I don't intend to harm your code, but you do it on your own responsibility 👍 EDIT: In case it doesn't work please make sure that |
Hey @megawebmaster, it worked so far. Thanks for the solution! |
I found out that https://github.com/proteriax/jsx-dom also has CommonJS version jsx-dom-cjs. Although only v7 and v8 are available. Tested: npm i jsx-dom-cjs@7 "overrides": {
"@remirror/extension-react-tables": {
"jsx-dom": "$jsx-dom-cjs"
}
}, No issues so far! |
@strdr4605 - I was worried that there might be some issues due to different major version, so I decided to have an override (which is specific for Meteor only). I'm glad you found another solution that works for you 💪 P.S. Another solution is to add only required packages to your |
I don't use React tables extension. But it's a dependency of @remirror/react. |
I ditched "@remirror/core": "^1.3.5",
"@remirror/extension-bidi": "^1.0.15",
"@remirror/extension-bold": "^1.0.15",
"@remirror/extension-emoji": "^1.0.18",
"@remirror/extension-events": "^1.0.16",
"@remirror/extension-hard-break": "^1.0.15",
"@remirror/extension-history": "^1.0.15",
"@remirror/extension-italic": "^1.0.15",
"@remirror/extension-link": "^1.1.14",
"@remirror/extension-list": "^1.2.16",
"@remirror/extension-mention-atom": "^1.0.19",
"@remirror/extension-paragraph": "^1.0.15",
"@remirror/extension-placeholder": "^1.0.18",
"@remirror/extension-positioner": "^1.1.17",
"@remirror/extension-strike": "^1.0.15",
"@remirror/extension-trailing-node": "^1.0.15",
"@remirror/extension-underline": "^1.0.15",
"@remirror/pm": "^1.0.11",
"@remirror/react-core": "^1.0.22",
"@remirror/react-hooks": "^1.0.23", |
I tried import { Remirror, useHelpers, useRemirror } from '@remirror/react-core';
import { useKeymap } from '@remirror/react-hooks';
export const MyEditor = () => {
const { manager, state, setState } = useRemirror({
extensions: () => [new BoldExtension()],
content: '<p>I love <b>Remirror</b></p>',
selection: 'start',
stringHandler: 'html'
}); but I get Context error: https://remirror.io/docs/errors/#rmr0200 |
@strdr4605 - isn't the context issue caused by import { Remirror, useHelpers, useRemirror } from '@remirror/react-core';
import { useKeymap } from '@remirror/react-hooks';
const Helpers = () => {
const available = useHelpers();
// Do something with helpers
};
export const MyEditor = () => {
const { manager, state, setState } = useRemirror({
extensions: () => [new BoldExtension()],
content: '<p>I love <b>Remirror</b></p>',
selection: 'start',
stringHandler: 'html'
});
return (
<Remirror manager={manager} initialContent={state}>
<Helpers />
</Remirror>
);
}; |
Summary
When importing from most packages in Meteor (Babel compiler) I get the error
on client and I'm unable to proceed.
Steps to reproduce
meteor create remirror
cd remirror
meteor npm add remirror @remirror/react @remirror/pm @remirror/styles --save
imports/ui/Hello.jsx
with:npm run
localhost:3000
and you will see a blank page with the error in the console.I have tried to recompile the package with Meteor build system, but without success.
Expected results
Error should not happen and imports should work normally.
Actual results
Application crashes with
Uncaught TypeError: module.exportDefault is not a function
Possible Solution
Further testing revealed that import and use of:
import { AllStyledComponent } from '@remirror/styles/styled-components';
works fine, so this might be a good start to look on what is different in package bundling between that one compare to the other ones.Screenshot(s)
The text was updated successfully, but these errors were encountered: