-
Notifications
You must be signed in to change notification settings - Fork 27
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
Dynamic requires causes webpack to include test files in bundle #7
Comments
@davej i see the webpack issue. Couldn't you add a rule in webpack to ignore test files from addons? This is what i do when packing for electron |
No, you don't need to maintain a list of plugins, the plugin would be imported outside of the import fit from "xterm/dist/addons/fit/fit";
import { XTerm } from "react-xterm";
export default () => (<XTerm addons={[fit]} />);
I tried the following, but it didn't seem to work (possibly because it's not a direct dependency of my project?): externals: [
"node-pty", "xterm"
] If I add |
@davej ok i see what you mean. Perso i don't want this. The point of the addon props is not to have to do the import, nor to care about the actual path. What about this? |
I tried a few similar things as in that link but couldn't get it to work. I ended up basically doing a copy/paste of Feel free to close this if it doesn't fit in with your usage. I can maintain this as a local component, it's not a big problem, 👍. |
@davej i don't want you to maintain it as a local component :D This is not the point of open sourcing :D It seems a little bit tricky with webpack but doable: I would like to help you more, but without knowing the layout of your project or your webpack file, it's a bit tricky |
My webpack config is: {
target: "electron-renderer",
externals: ["node-pty"]
} I'm using electron-next. I'll give that webpack plugin a quick try now and see if it works for me. |
Hi guys,
and it worked only after adding the file extension like so:
Hope this help. |
I'm guessing this is no longer an issue in the new RC I am building since xterm no longer bundles addons but will test & close as appropriate. |
react-xterm
contains dynamic requires which causes Webpack to be overly aggressive when bundling and include all the addons and corresponding tests:Causing the following error:
Perhaps the signature of
this.props.addons
can be an array of the addon modules directly, rather than an array of strings which are converted into dynamic imports?The text was updated successfully, but these errors were encountered: