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
Tracking serialport with webpack #901
Comments
SerialPort 4.x is the latest version for the record. You're using 3x. We switched to In the streams cleanup the filenames are being changed a bit, but that's a major bug in webpack if it can't deal with package and filenames being the same. |
well.... i was waiting for a good reason to upgrade to upgrade to 4.x haha thanks @reconbot, will let you know if the upgrade solves the issue |
Possibly related webpack/webpack#1114 |
This is a link to how the |
I don't see a clear answer on what people did to make it work. Anything jump out to you? I'd honestly not use webpack for the serialport module you can have it ignore |
I've been seeing a few issues with other binary modules and webpack. I don't believe it can be properly bundled as it requires non js files (the binary module). There's no way to get a single bundle file out of it. No webpack loader that handles it. I'm going to close this issue as it's a webpack problem not a serialport problem. But I'm open to supporting webpack in the future if there is a change we can make to make it happen. In the near future we'll be providing chrome serialport support that will browserify/webpack just fine. Probably not what you're looking for however. |
Ok I'm going to solve this and post the solution here and see if there is something I can suggest for a future feature request on serial port. Great work @reconbot |
@aj-ptw, you need to mark bindings or serialport as an external dependency to webpack. In the node and electron webpack targets that will result in a small module in the webpack output that will The config to webpack to mark the externals can be pretty simple (and there are more complex options to achieve the same) // in webpack options
externals: {
bindings: true,
serialport: true,
} The original error posted relates to bindings using a statement |
You can probably just mark |
I'm still struggling with this issue. I have added the `externals: { serialport: true} option to Webpack and I'm still unable to require serialport in any code. Could someone supply me with an example Webpack config file and a use case? Thanks in advance. |
@Twistedst you can try below
|
I've always seen it as `serialport:"serialport"`
…On Fri, Mar 24, 2017, 10:26 AM keyiis ***@***.***> wrote:
@Twistedst <https://github.com/Twistedst> you can try below
externals: {
.....
"serialport": "require('serialport')"
.....
}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#901 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABlbtyc-iEnrAKGqHZ032ImDT7lQLY9ks5ro9J3gaJpZM4JgUF->
.
|
This is the relevant section for configuring webpack.
http://webpack.github.io/docs/configuration.html#externals webpack 1
https://webpack.js.org/configuration/externals/#externals Webpack 2
On Fri, Mar 24, 2017 at 10:30 AM Francis Gulotta <notifications@github.com>
wrote:
… I've always seen it as `serialport:"serialport"`
On Fri, Mar 24, 2017, 10:26 AM keyiis ***@***.***> wrote:
> @Twistedst <https://github.com/Twistedst> you can try below
>
> externals: {
> .....
> "serialport": "require('serialport')"
> .....
> }
>
> —
> You are receiving this because you were mentioned.
>
>
> Reply to this email directly, view it on GitHub
> <
#901 (comment)
>,
> or mute the thread
> <
https://github.com/notifications/unsubscribe-auth/AABlbtyc-iEnrAKGqHZ032ImDT7lQLY9ks5ro9J3gaJpZM4JgUF-
>
> .
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#901 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAy3EuBnXNziwE52CPBPokUjNYa_Knsoks5ro9OBgaJpZM4JgUF->
.
|
That's super helpful, thank you |
thanks |
SerialPort version: 3.1.2
NodeJS Version: 6.3.1
Operating System and Hardware: OSx
Are you using Electron/Atom/NwJS?: Electron and Webpack
(Run
node -v && npm -v && python --version
to get version numbers)Summary of Problem
Serialport fails to build with web pack
Expected Behavior
No errors on building
Actual Behavior
Steps and Code to Reproduce the Issue
Try to build serialport with webpack (specifically
electron-react-boilerplate
)I think serialport could fix this issue because stefanpenner/es6-promise#100
I think a big problem might be the fact that
bindings.js
is the same name as the modulebindings
which is going to break web pack and building with native modules.The text was updated successfully, but these errors were encountered: