-
Notifications
You must be signed in to change notification settings - Fork 54
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
fsevents get error "Module parse failed: Unexpected character '�' (1:0)" #71
Comments
This does not seem to be a problem of |
@jiereal , did you get the fix for it? I am also getting the same issue. I tried downgrading the fsevents package but that didn't help. |
@Ratn how can I fix this when it's coming from |
also getting it: Node 12, Electron 8.0, Typescript (webpack + ts-loader) |
@moarwick @Ratn I stumbled into the same problem today. A valid workaround for this problem is to add
The issue is caused by this line |
@pverscha why would you guys want to include |
@yan-foto I don't, I just stumbled into this thread and it was the only one that comes up on Google with this problem. It's completely fsevents related, but I just wanted to post a solution here to help fellow Googlers of the problem ;) |
@pverscha thanks! I really appreciate that someone finally found the culprit here. |
@Didericis Thanks! I'm not sure how that works though? I didn't have a Brave account (made one just now). |
@pverscha Sure thing! Once you create a publisher/creator account, you should see an "add channel" option for github. Once you link your brave account with your github account/verify that you own the github account, it should work/you'll see a tip there. On my end I just clicked a little icon Brave added to your comment. |
I also encountered this problem yesterday when I try to require chokidar module in my vue-cli3 with electron-builder project. And this error only occurs on Mac OS. After trying all the above methods, they finally failed. Since the problem is caused by |
Upgrade to v5.x using `vue upgrade --next`. Update `vue.config.js` to import and use `defineConfig`, because it provides type safety and created by Vue CLI 5 as default. Vue CLI 5.x upgrades from webpack 4 to 5. It causes some issues that this commit attemps to fix: 1. Fail due to webpack resolving of Ace. Third-party dependency (code editor) Ace uses legacy `file-loader` for webpack resolving. It's not supported in webpack 5. So change it with manual imports. Refs: ajaxorg/ace-builds#211, ajaxorg/ace-builds#221. 2. Wehpack drops polyfilling node core modules (`path`, `fs`, etc.). Webpack does not polyfill those modules by default anymore. This is good because they did not need browser polyfilling as they are used in desktop version only and resolved already by Electron. To resolve errors (using webpack recommendations): - Add typeof check around `process` variable. - Tell webpack explicitly to ignore used node modules. 3. Fail due to legacy dependency of vue-cli-plugin-electron-builder. This plugin is used for electron builds and development. It still uses webpack 4 that leads to failed builds. Downgrading `ts-loader` to latest version which has support for `loader-utils` solves the problem (TypeStrong/ts-loader#1288). Related issue: nklayman/vue-cli-plugin-electron-builder#1625 4. Compilation fails due to webpack loading of `fsevents` on macOS. This happens only when running `vue-cli-service test:unit` command (used in integration tests and unit tests). Other builds work fine. Refs: yan-foto/electron-reload#71, nklayman/vue-cli-plugin-electron-builder#712, nklayman/vue-cli-plugin-electron-builder#1333
Thanks @pverscha . For my case both your solution or setting: module.exports = {
//...
externals: ['fsevents'],
}; Solved the problem for me. |
use node-loader. |
ERROR in ./node_modules/fsevents/fsevents.node 1:0 Module parse failed: Unexpected character '�' (1:0) yan-foto/electron-reload#71
Upgrade to v5.x using `vue upgrade --next`. Update `vue.config.js` to import and use `defineConfig`, because it provides type safety and created by Vue CLI 5 as default. Vue CLI 5.x upgrades from webpack 4 to 5. It causes some issues that this commit attemps to fix: 1. Fail due to webpack resolving of Ace. Third-party dependency (code editor) Ace uses legacy `file-loader` for webpack resolving. It's not supported in webpack 5. So change it with manual imports. Refs: ajaxorg/ace-builds#211, ajaxorg/ace-builds#221. 2. Wehpack drops polyfilling node core modules (`path`, `fs`, etc.). Webpack does not polyfill those modules by default anymore. This is good because they did not need browser polyfilling as they are used in desktop version only and resolved already by Electron. To resolve errors (using webpack recommendations): - Add typeof check around `process` variable. - Tell webpack explicitly to ignore used node modules. 3. Fail due to legacy dependency of vue-cli-plugin-electron-builder. This plugin is used for electron builds and development. It still uses webpack 4 that leads to failed builds. Downgrading `ts-loader` to latest version which has support for `loader-utils` solves the problem (TypeStrong/ts-loader#1288). Related issue: nklayman/vue-cli-plugin-electron-builder#1625 4. Compilation fails due to webpack loading of `fsevents` on macOS. This happens only when running `vue-cli-service test:unit` command (used in integration tests and unit tests). Other builds work fine. Refs: yan-foto/electron-reload#71, nklayman/vue-cli-plugin-electron-builder#712, nklayman/vue-cli-plugin-electron-builder#1333
What is the problem
node: 10.12.0
electron: 6.0.7
How to reproduce
just
require("electron-reload")(__dirname)
Additional information
The text was updated successfully, but these errors were encountered: