Coder Social home page Coder Social logo

Comments (2)

zodiacfireworks avatar zodiacfireworks commented on August 28, 2024

Same problem here ✋

The error I got was

🚨  Cannot read property 'clear' of undefined
    at Bundler.bundler.on (/path_to_my_project_folder/node_modules/parcel-plugin-eslint/index.js:22:28)
    at emitOne (events.js:116:13)
    at Bundler.emit (events.js:211:7)
    at Bundler.bundle (/path_to_my_project_folder/node_modules/parcel-bundler/src/Bundler.js:212:12)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

Looking at the file /path_to_my_project_folder/node_modules/parcel-plugin-eslint/index.js, I found the following code

    bundler.on('bundled', () => {
        let cache;
        try {
            cache = jsonfile.readFileSync(constFile.cacheFile);
        } catch (e) {
            cache = {};
        }
        cache.log = cache.log || [];
        if (cache.log.length) {
            bundler.logger.clear(); // -->The error is fired here
        }
        cache.log.forEach(element => {
            bundler.logger.write(element);
        });

        jsonfile.writeFileSync(constFile.cacheFile, {});
    });

I suppose that the condition if (cache.log.length) ... is not sufficient to ensure the existence of logger in the bundler. Replacing such condition for something like if (cache.log.length && bundler.logger) ... may help.

I'm working in my first project with Parcel and Vuejs, and didn't know much about JS tooling.

Software Version(s)
Parcel "^1.6.2"
Vue "^2.5.13"
Node "^8.9.3"
Yarn "^1.3.2"
Operating System "Linux Deepin 15.5"

Update

Using if (cache.log.length && bundler.logger) ... raises another error in

        cache.log.forEach(element => {
            bundler.logger.write(element); // -->New error is fired here
        });

Adding a console.log(typeOf(bundler.logger)) shows that bundler.logger is never defined.

from parcel-plugin-eslint.

mzabielski avatar mzabielski commented on August 28, 2024

From what I investigated, in index.js you should replace bundler.logger with logger and add

const logger = require('parcel-bundler/src/Logger');

to the top of file, because Logger instance is no longer placed as a property of Bundler.

from parcel-plugin-eslint.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.