Skip to content

Webpack5Β #43

@linonetwo

Description

@linonetwo
          parser.hooks.new.for('imported var').tap(NAME, expr => {
            if (expr.callee.name !== 'Worker') return false

Can be changed to this, because 'imported var' is not supported.

        parser.hooks.new.for('Worker').tap(NAME, function (expr) {

But still get TypeError: ParserHelpers.addParsedVariableToModule is not a function, and I searched issue GoogleChromeLabs#88 seems have a workaround, but ParserHelpers.getModulePath is gone too:

this update is useless

          ParserHelpers.addParsedVariableToModule(parser, id, req);

to

let ModuleDecoratorDependency;
try {
  ModuleDecoratorDependency = require("webpack/lib/dependencies/ModuleDecoratorDependency");
} catch (e) {}

// ...

          if (ModuleDecoratorDependency) {
            const dep = new ModuleDecoratorDependency(
              ParserHelpers.getModulePath(parser.state.module.context, req),
              parser.state.module
            );
            dep.loc = expr.loc;
            parser.state.module.addDependency(dep);
          } else {
            ParserHelpers.addParsedVariableToModule(parser, id, req);
          }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions