Comments (13)
Sorry for incorrect webpack build target setting. I set it to atom
now.
import fs from 'fs'
will work after this fix been merged.
from electron-react-boilerplate.
Any other issues and issue reopen will be welcome.
from electron-react-boilerplate.
Hi, thanks for the quick fix. However I'm now running into a problem with webpack when it tries to include serialport. The first part of the warnings are below. It seems like webpack is trying to load every file in the module folder.
WARNING in ./~/serialport/serialport.js
Critical dependencies:
14:24-45 the request of a dependency is an expression
@ ./~/serialport/serialport.js 14:24-45
WARNING in ./~/serialport/~/node-pre-gyp/lib/pre-binding.js
Critical dependencies:
19:22-48 the request of a dependency is an expression
@ ./~/serialport/~/node-pre-gyp/lib/pre-binding.js 19:22-48
WARNING in ./~/serialport/~/node-pre-gyp/lib/util/versioning.js
Critical dependencies:
15:20-67 the request of a dependency is an expression
@ ./~/serialport/~/node-pre-gyp/lib/util/versioning.js 15:20-67
WARNING in ./~/serialport/~/node-pre-gyp/lib/util/compile.js
Module not found: Error: Cannot resolve module 'node-gyp' in /Users/me/Development/myapp/node_modules/serialport/node_modules/node-pre-gyp/lib/util
@ ./~/serialport/~/node-pre-gyp/lib/util/compile.js 29:28-55
WARNING in ./~/serialport/~/node-pre-gyp/lib/util/compile.js
Module not found: Error: Cannot resolve module 'npm' in /Users/me/Development/myapp/node_modules/serialport/node_modules/node-pre-gyp/lib/util
@ ./~/serialport/~/node-pre-gyp/lib/util/compile.js 39:27-49
WARNING in ./~/serialport/AUTHORS
Module parse failed: /Users/me/Development/myapp/node_modules/serialport/AUTHORS Line 1: Unexpected token ILLEGAL
You may need an appropriate loader to handle this file type.
| # The main authors of this library
|
| Chris Williams <[email protected]>
@ ./~/serialport ^\.\/.*$
WARNING in ./~/serialport/LICENSE
Module parse failed: /Users/me/Development/myapp/node_modules/serialport/LICENSE Line 1: Unexpected number
You may need an appropriate loader to handle this file type.
| Copyright 2010, 2011, 2012 Christopher Williams. All rights reserved.
| Permission is hereby granted, free of charge, to any person obtaining a copy
| of this software and associated documentation files (the "Software"), to
@ ./~/serialport ^\.\/.*$
WARNING in ./~/serialport/Makefile
Module parse failed: /Users/me/Development/myapp/node_modules/serialport/Makefile Line 1: Unexpected token =
You may need an appropriate loader to handle this file type.
| VERSION := $(shell node -e "console.log(require('./package.json').version)")
|
| .PHONY: default release
@ ./~/serialport ^\.\/.*$
WARNING in ./~/serialport/appveyor.yml
Module parse failed: /Users/me/Development/myapp/node_modules/serialport/appveyor.yml Line 1: Unexpected token ILLEGAL
You may need an appropriate loader to handle this file type.
| # environment variables
| environment:
| node_pre_gyp_secretAccessKey:
@ ./~/serialport ^\.\/.*$
WARNING in ./~/serialport/arduinoTest/arduinoEcho/arduinoEcho.ino
Module parse failed: /Users/me/Development/myapp/node_modules/serialport/arduinoTest/arduinoEcho/arduinoEcho.ino Line 1: Unexpected identifier
You may need an appropriate loader to handle this file type.
| const int ledPin = 11;
|
| void setup() {
@ ./~/serialport ^\.\/.*$
WARNING in ./~/serialport/bin/serialportList.js
Module parse failed: /Users/me/Development/myapp/node_modules/serialport/bin/serialportList.js Line 1: Unexpected token ILLEGAL
You may need an appropriate loader to handle this file type.
| #!/usr/bin/env node
|
| var serialport = require('../');
@ ./~/serialport ^\.\/.*$
WARNING in ./~/serialport/bin/serialportTerminal.js
Module parse failed: /Users/me/Development/myapp/node_modules/serialport/bin/serialportTerminal.js Line 1: Unexpected token ILLEGAL
You may need an appropriate loader to handle this file type.
| #!/usr/bin/env node
|
| var SerialPort = require('../').SerialPort;
@ ./~/serialport ^\.\/.*$
WARNING in ./~/serialport/binding.gyp
Module parse failed: /Users/me/Development/myapp/node_modules/serialport/binding.gyp Line 2: Unexpected token :
You may need an appropriate loader to handle this file type.
| {
| 'targets': [
| {
| 'target_name': 'serialport',
@ ./~/serialport ^\.\/.*$
WARNING in ./~/serialport/build/Makefile
Module parse failed: /Users/me/Development/myapp/node_modules/serialport/build/Makefile Line 1: Unexpected token ILLEGAL
You may need an appropriate loader to handle this file type.
| # We borrow heavily from the kernel build setup, though we are simpler since
| # we don't have Kconfig tweaking settings on us.
|
@ ./~/serialport ^\.\/.*$
And then there are these errors starting with:
ERROR in ./~/serialport/~/node-pre-gyp/lib/node-pre-gyp.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../package in /Users/me/Development/myapp/node_modules/serialport/node_modules/node-pre-gyp/lib
@ ./~/serialport/~/node-pre-gyp/lib/node-pre-gyp.js 60:16-37
ERROR in ./~/serialport/arduinoTest/stress.js
Module not found: Error: Cannot resolve module 'colors' in /Users/me/Development/myapp/node_modules/serialport/arduinoTest
@ ./~/serialport/arduinoTest/stress.js 8:13-30
ERROR in ./~/serialport/arduinoTest/stress.js
Module not found: Error: Cannot resolve module 'memwatch' in /Users/me/Development/myapp/node_modules/serialport/arduinoTest
@ ./~/serialport/arduinoTest/stress.js 10:15-34
ERROR in ./~/serialport/test/parsers.js
Module not found: Error: Cannot resolve module 'sinon-chai' in /Users/me/Development/myapp/node_modules/serialport/test
@ ./~/serialport/test/parsers.js 5:16-37
ERROR in ./~/serialport/test_mocks/linux-hardware.js
Module not found: Error: Cannot resolve module 'sandboxed-module' in /Users/me/Development/myapp/node_modules/serialport/test_mocks
@ ./~/serialport/test_mocks/linux-hardware.js 144:22-49
ERROR in ./~/serialport/~/node-pre-gyp/~/rc/index.js
Module parse failed: /Users/me/Development/myapp/node_modules/serialport/node_modules/node-pre-gyp/node_modules/rc/index.js Line 1: Unexpected token ILLEGAL
You may need an appropriate loader to handle this file type.
| #! /usr/bin/env node
| var cc = require('./lib/utils')
| var join = require('path').join
@ ./~/serialport/~/node-pre-gyp/lib/info.js 11:13-26
ERROR in ./~/serialport/~/node-pre-gyp/lib/info.js
Module not found: Error: Cannot resolve module 'aws-sdk' in /Users/me/Development/myapp/node_modules/serialport/node_modules/node-pre-gyp/lib
@ ./~/serialport/~/node-pre-gyp/lib/info.js 14:14-32
ERROR in ./~/serialport/~/node-pre-gyp/lib/publish.js
Module not found: Error: Cannot resolve module 'aws-sdk' in /Users/me/Development/myapp/node_modules/serialport/node_modules/node-pre-gyp/lib
@ ./~/serialport/~/node-pre-gyp/lib/publish.js 17:14-32
from electron-react-boilerplate.
Nevermind. I am also seeing these errors when I use webpack on just a simple file which includes node-serialport. So it has nothing to do with your specific webpack configuration or the electron environment...
from electron-react-boilerplate.
I should add .json
and .node
to resolve.extensions
for imitating node require.
And some errors about Cannot resolve module ... It looks like devDependencies
are not installed.
from electron-react-boilerplate.
Ah wonderful! I'm glad you have a clue :)
Now I think about it, I guess it's pretty weird to try and pack a natively compiled module into static assets. I guess that's what webpack tries to do now.
from electron-react-boilerplate.
Maybe we should find some webpack config, loader, plugin...whatever to handle this expression dependency...
var PACKAGE_JSON = path.join(__dirname, 'package.json');
var binding_path = binary.find(path.resolve(PACKAGE_JSON));
var SerialPortBinding = require(binding_path);
from electron-react-boilerplate.
According to this webpack/webpack#1040 you can use node-loader. Not sure what other problem we are trying to solve :) I am currently figuring out how to compile serialport for iojs since there is also an issue there it seems...
from electron-react-boilerplate.
Add node_modules
to externals
will fix some of issues.
from electron-react-boilerplate.
Thanks, I think we're getting there :) Here's a nice article covering that plus more interesting things
http://jlongster.com/Backend-Apps-with-Webpack--Part-I
from electron-react-boilerplate.
I managed to get serialport working with these changes. It looks like you've already committed similar ones to the develop branche so I will check that soon.
from electron-react-boilerplate.
Thanks for sharing a useful post. I also look into library-and-externals.
So many configs let me a little confused. haha
Now I can require('serialport')
on develop
branch with no webpack issues.
from electron-react-boilerplate.
I have a similar problem trying to use node canvas
module via fabric.js
from electron-react-boilerplate.
Related Issues (20)
- Startup Dependencies with Python
- Tailwind Template provided
- environment variable values are appeared directly in production code HOT 4
- Issue with node-7z only in packaged app [not really a bug, asking for help]
- Great boilerplate!!! But I was trying to use electron-builder to build installers for windows, I am unable to achieve it, can somebody guide me on this?
- Unable to build installers using electron-builder, how to resolve this?
- How to solve this problem with postinstall$ node install.js
- dll renderer webpack error on tiptap npm install
- Can't import child_process
- Removing unnecessary electron languages
- how do i add encryption to my saved file with electron-store
- Issue in package of boilorplate
- Build Electron-React-Boilerplate With Tailwindcss
- Relaunch Electron App
- Code signing issue
- How to debug in VS code? HOT 1
- Cli Truncate Package Missing
- An unhandled rejection has occurred inside Forge: TypeError: Cannot read properties of undefined (reading 'split') HOT 1
- request HOT 1
- React Router NavLink not working HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from electron-react-boilerplate.