Skip to content
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

Check for background script breaks for more complicated output.filename rules #118

Open
2 of 6 tasks
tfedor opened this issue Nov 4, 2020 · 0 comments
Open
2 of 6 tasks

Comments

@tfedor
Copy link

tfedor commented Nov 4, 2020

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS: Independent
  • Browser: Independent
  • Library Version: 1.1.4

I'm going to open a PR:

  • yes
  • no

Description:

I was getting error #WER-E1, so I went investigating, and I found out piece of code starting here can't work with more complicated output.filename rules:

const toRemove = (filename as string).replace("[name]", "");

Consider following:

// manifest
background.scripts: "js/background.js";

// webpack
entry: { background: "..." }
output.filename: "js/[name].js"

When we reach entries check on line 29, what happens is we will get replace rule js/.js, which obviously can't work as expected.

I would suggest replacing that check with somethinig like this:

  const bgWebpackEntry = Object.keys(webpackEntry).find(entryName =>
    bgScriptFileNames.some(
      bgManifest => filename.replace("[name]", entryName) === bgManifest,
    ),
  );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant