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

BUG | use the latest network API of V3 #52

Closed
2 tasks done
deno-source opened this issue Jun 27, 2022 · 10 comments
Closed
2 tasks done

BUG | use the latest network API of V3 #52

deno-source opened this issue Jun 27, 2022 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@deno-source
Copy link

What happened?

image

image

I want to use the latest network API of V3, but it seems that it is not very friendly to JSON files after compilation, and it becomes a JS file.

Version

Latest

What OS are you seeing the problem on?

Windows

What browsers are you seeing the problem on?

Chrome

Relevant log output

No response

(OPTIONAL) Contact Details

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I checked the current issues for duplicate problems.
@deno-source deno-source added the bug Something isn't working label Jun 27, 2022
@deno-source deno-source changed the title BUG | BUG | use the latest network API of V3 Jun 27, 2022
@ColdSauce
Copy link
Contributor

Thanks for the report! We'll look into resolving this soon.

@louisgv louisgv self-assigned this Jun 27, 2022
@louisgv
Copy link
Contributor

louisgv commented Jun 28, 2022

This should be fixed in parcel-bundler/parcel#8189, and since latest plasmo is using parcel 2.6.2 (which includes the fix), I think all you need to do is upgrade plasmo to latest version @deno-source

Also, for this case, you do not need to use the url scheme - it's mainly used in source code. This should work (or at least it did on my machine xD)

    "declarative_net_request": {
      "rule_resources": [
        {
          "id": "ruleset_1",
          "enabled": true,
          "path": "~rulesets/test.json"
        }
      ]
    }

@louisgv
Copy link
Contributor

louisgv commented Jun 28, 2022

Future note: we might want to add this to our documentation

@louisgv
Copy link
Contributor

louisgv commented Jun 28, 2022

@deno-source
Copy link
Author

This should be fixed in parcel-bundler/parcel#8189, and since latest plasmo is using parcel 2.6.2 (which includes the fix), I think all you need to do is upgrade plasmo to latest version @deno-source

Also, for this case, you do not need to use the url scheme - it's mainly used in source code. This should work (or at least it did on my machine xD)

    "declarative_net_request": {
      "rule_resources": [
        {
          "id": "ruleset_1",
          "enabled": true,
          "path": "~rulesets/test.json"
        }
      ]
    }

That's great! That solved my puzzle! Thank you very much for your answer!

@louisgv louisgv closed this as completed Jun 28, 2022
@deno-source
Copy link
Author

doc updated: https://docs.plasmo.com/workflows/faq#tilde-import-resolution

I want to inject a script, using the ~ method does not seem to work, is there any other way, indexJS does not depend on any, this is a separate script

image
image

@louisgv
Copy link
Contributor

louisgv commented Jun 28, 2022

@deno-source https://docs.plasmo.com/workflows/content-scripts#importing-web-accessible-resources (do this in a content script that wake up your background script with the path to the bundled index.js)

@deno-source
Copy link
Author

image

image

I have tried this method but still get errors

@deno-source
Copy link
Author

@deno-source
Copy link
Author

@deno-source https://docs.plasmo.com/workflows/content-scripts#importing-web-accessible-resources (do this in a content script that wake up your background script with the path to the bundled index.js)

Also, I don't want this file to be packed and compressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants