Code Monkey home page Code Monkey logo

Comments (5)

rjgotten avatar rjgotten commented on June 22, 2024 1

Getting this as well.
Attached a debugger to investigate.

The problem is the loader is not hitting the parser anymore - because there's nothing to parse thanks to the cache; and thus the export declaration hook that is meant to collect exported methods is no longer run.

However, as the output of the loader is marked non-cachable, that part actually will rebuild every time. And ofcourse, after the first build it gets an empty array of collected methods.

The solution here is, I think, to use the Webpack cache to cache the array of exported methods along with the modules. or to somehow mark the entry module of the worker as non-cacheable which forces it to always be processed from source, and always have the parser run.

[EDIT]
Actually: it's even easier than that.
There is no reason to manually bookkeep the exports with the parser hook at all.
Technically, under the assumption that users will only export methods from the entry module of the worker, the only thing you need is:

const exportNames = compilation.moduleGraph.getProvidedExports(entryModule);

from workerize-loader.

gersomvg avatar gersomvg commented on June 22, 2024

Bypassed this issue by using webpack / Workers directly without this loader and RPC implementation. Feel free to investigate further or close this issue if you don't plan to have support for Gatsby out of the box 👍🏻

from workerize-loader.

saltenhub avatar saltenhub commented on June 22, 2024

Running into the same issue with a recent version of create react app (v. 5.0.1). Had to disable the webpack cache as a workaround. Would be great if this could be taken care of on the library side

from workerize-loader.

ysneo avatar ysneo commented on June 22, 2024

yes same situation, when I cancel 的 webpack cache, it works fine. So how to make them coexist

from workerize-loader.

rjgotten avatar rjgotten commented on June 22, 2024

@ysneo
yes same situation, when I cancel 的 webpack cache, it works fine. So how to make them coexist

There's no way to hot-patch your way through it.
The internals of the plugin have to be rewired.

from workerize-loader.

Related Issues (20)

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.