Warnings in terminal when using with vue cli (eslint + prettier configured)
Cornpop456 opened this issue · 1 comments
A problem ocurred only in worker file, prettier is configured to auto format all js file on save
This is simple example which i play with, everything is fine except this warnings and the fact that hmr does not triggered by changes in worker file (but it seems to be a normal behavior if i am not wrong)
self.arr = [];
self.addEventListener('connect', (ev) => {
let port = ev.ports[0];
console.log(self.arr);
port.postMessage('hello i am cool shared worker!');
port.addEventListener('message', function (e) {
self.arr.push(2);
console.log(...self.arr);
port.postMessage(e.data);
});
port.start();
});
I did not change anything in any configs, generated by vue-cli, babel, eslint, etc
Only added this plugin to support workers
const WorkerPlugin = require('worker-plugin');
module.exports = {
configureWebpack: {
plugins: [new WorkerPlugin({ sharedWorker: true })],
},
};
I had a similar issue with Vue + eslint.
Except my eslint config treated deviation from the code style as errors, causing the build to fail randomly about half of the time.
Syntax Error: ModuleError: Module Error (from ./node_modules/thread-loader/dist/cjs.js):
1:27 error Extra semicolon semi
1:28 error Newline required at end of file but not found eol-last
I found a workaround in adding a proxy file and disabling eslint by adding /* eslint-disable */ to the beginning of the file.
proxy-shared-worker.js
/* eslint-disable */
import './real-shared-worker.js'